Giter Site home page Giter Site logo

detektivo's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

detektivo's Issues

How to ?

Thank you for this addon...
But, I'm a bit lost...
I upload the addon on cockpit... I go to settings > Addons, and I only see a block with Detektivo...
How can I active it ?
Where must I put the config file ?

Can you help me a bit ?

Thanks !

API spec

Hello,
I would like to use this plugin with Cockpit CMS Next. I managed to install the addon, but don't know how to get to REST API of client provided query. My configuration:

engine: tntsearch
collections:
    posts: [title, excerpt, content]

Reading this project's php files it looks like there is no single REST endpoint, that is registered at /api. How to make a query?

Doesn't seem to work anymore

I've just tried out this addon with Cockpit 0.10.0 and it doesn't seem to work anymore. I used the tntsearch engine and did include a collection with fields to index in the config.yaml. I can also call the REST endpoint but it always just returns an empty array.

config.yaml:

detektivo:
  engine: tntsearch

  collections:
    posts: [title, excerpt, content]

Error 500 (Internal Server Error)

Hey Artur,

I'm fiddling around with this promising module. I've replicated your configuration file:

engine: algolia
app_id: MYAPPID
api_key: MYAPPAPIKEY
collections:
    posts: [title, excerpt, content]

Accompanying this i've made a collection type called posts with the fields title, excerpt and content. So far so good.
The problem hits when i create a new post and try to save it. The CMS fails with a system error and spits this back into the console:

app.js?ver=0.5.1:71 POST http://cockpit.template-studio.nl/collections/save_entry/posts 500 (Internal Server Error)

screenshot from 2018-01-24 14-03-50
screenshot from 2018-01-24 14-04-24

Any ideas of whats wrong, and what the solution might be?

Cheers,

Lasse

Cockpit:
Version | 0.5.1
Version | 7.0.22-0ubuntu0.16.04.1
-- | --
PHP SAPI | apache2handler
System | Linux vps341395 4.4.0-109-generic #132-Ubuntu SMP Tue Jan 9 19:52:39 UTC 2018 x86_64
Loaded Extensions | Core, date, libxml, openssl, pcre, zlib, filter, hash, Reflection, SPL, session, standard, apache2handler, mysqlnd, PDO, xml, calendar, ctype, curl, dom, mbstring, fileinfo, ftp, gd, gettext, iconv, imagick, imap, intl, json, exif, mcrypt, mysqli, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, Phar, posix, readline, shmop, SimpleXML, sockets, sqlite3, sysvmsg, sysvsem, sysvshm, tokenizer, wddx, xmlreader, xmlwriter, xsl, zip, Zend OPcache
Memory limit | 512M
Upload file size limit | 200M

Trouble indexing/reindexing

Hi! having some trouble indexing/reindexing on with the newest cockpit-next and newest detektivo.

Regardless engine, the indexing spinner just keeps going and checking the network tab I can find the following response:

<br />
<b>Warning</b>:  Invalid argument supplied for foreach() in <b>cockpit-next/addons/Detektivo/Storage/Algolia.php</b> on line <b>30</b><br />
<br />
<b>Warning</b>:  Invalid argument supplied for foreach() in <b>cockpit-next/addons/Detektivo/vendor/algolia/algoliasearch-client-php/src/AlgoliaSearch/Index.php</b> on line <b>1447</b><br />
{"finished":true,"imported":1}

I also get the following javascript error:

Uncaught (in promise) TypeError: Cannot read property 'imported' of null
    at <anonymous>:13:33

Any idea what this might be about?

It worked on a clean install but when I copied over my storage directory from production it broke. I'm just indexing simple text fields.

Configuration with Cockpit config.php file

Hello,
I am trying to add Detektivo-Algolia to my Cockpit but I cannot understand what I do wrong in the config.php file. All examples I found are with config.yaml but in my version of Cockpit the config file is .php.
I tried by going to Settings --> settings --> config/config.php and adding this:
'detektivo' => [
'engine' => 'algolia',
'app_id' => 'MXXXXXI',
'api_key' => 'xxxxxxxxxxxxxxxx'
]

but once saved I get this error:
Parse error: syntax error, unexpected '"detektivo"' (T_CONSTANT_ENCAPSED_STRING), expecting ']' in /var/www/html/config/config.php on line 6

What I am doing wrong?
Thanks

Support for basic filtering of collections e.g. only indexing published posts

The addon is brilliant so thank you for creating it.

It would be great to add basic filtering on collection fields so that you can choose to only index certain items in a collection.

For example if you have a collection of blog posts you might not wish to index posts that are currently drafts and have not yet been published as they could then appear in any search queries.

Perhaps doing something like this in config.yaml

detektivo:
    engine: algolia
    app_id: <APP-ID>
    api_key: <API-KEY>
    collections:
        posts: [published:true, title, excerpt, content]

I updated a couple of files to get the above config.yaml working for my use case however the implementation isn't great.

In Controller/Admin.php update the foreach loop in the reindex method on line 33

foreach ($fields as $field) {
    $parts = explode(':', $field);
    $field = $parts[0];

    $options['fields'][$field] = 1;

    if(isset($parts[1])){
        $filter = $parts[1];

        if($filter == 'true'){
            $filter = true;
        } else if($filter == 'false'){
            $filter = false;
        }

        $options['filter'][$field] = $filter;
    }
}

In bootstrap.php update the foreach loop in 'collections.save.after' on line 78

foreach ($fields as $field) {
    $parts = explode(':', $field);
    $field = $parts[0];

    if (isset($entry[$field])) {
        $data[$field] = $entry[$field];

        if(isset($parts[1])){
            $filter = $parts[1];

            if($filter == 'true'){
                $filter = true;
            } else if($filter == 'false'){
                $filter = false;
            }

            if($entry[$field] !== $filter){
                return;
            }
        }
    }
}

Now whenever reindexing or saving a blog post if you have set published:true in your config.yaml only published posts will be indexed with your Detektivo engine (in my case Algolia).

This seems to work with simple filtering like the below but the implementation could definitely be improved.

posts: [published:true, title:Example Post, excerpt, content]

Help to integrate?

Hi, im trying to integrate using TNTSEARCH.

Someone can help me?

#pesquisa
   'detektivo' => [
      'engine' => 'tntsearch',
      'collections' => [
          'businessunit' => ['name']
      ]
  ]

Its my code, but when i make the GET to search with the name nothing =(

I need do something more? coding in some place?

Thanks

Indexing a complex field in detektivo makes Cockpit say "Saving failed"

Hi!
We have a collection with complex field that makes Cockpit say "Saving failed" (though the content is saved).

If I set this particular field to be indexed in config.yaml cockpit always responds with "Saving failed". If I remove this field from being indexed everything is fine.

I previously opened a similar issue in Cockpit which I believed was fixed by updating to the newest Detektivo, but that only helped because the settings had moved from detektivo.yaml so in effect the problematic field wasn't indexed anymore. Now that I moved the detektivo config into the config.yaml the problem has come back.

One difference: Before I updated Detektivo, the ajax save call resulted in the following error:
Warning: mb_strtolower() expects parameter 1 to be string, array given in /addons/Detektivo/vendor/teamtnt/tntsearch/src/Support/Tokenizer.php on line 8

With the newest detektivo and the config in the right place the ajax call returns with 200 ok. But the error message still pops up.

This is the problematic field:

{
  "fields": [
    {
      "type": "image",
      "label": "Image"
    },
    {
      "type": "set",
      "label": "Content",
      "options": {
        "fields": [
          {
            "name": "Subtitle",
            "type": "text"
          },
          {
            "name": "Text",
            "type": "wysiwyg"
          }
        ]
      }
    },
    {
      "type": "text",
      "label": "Youtube ID"
    }
  ]
}

I would love to help debug this but I need some pointers since I'm no longer getting an error message back with the ajax request.

Question about the search options

Hey guys, how are you?
Here in my TNTSeaech.php on search function we have 3 parameters, $index its my collection, i have $query and its my "search" and i have $options... what is this?

And i have other question: if i save a post with this title "paralelepipedo" i cant found just writing "parale" i need write the complete sentence how can i change it?

Thanks

License

Hello @aheinze !
Is there any license under which this code is being distributed?

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.