Coder Social home page Coder Social logo

Comments (9)

MrHash avatar MrHash commented on July 16, 2024

You can. I'll add an example as soon as possible.

from search.

pdrosos avatar pdrosos commented on July 16, 2024

Thank you very much! Could we expect the example soon?

from search.

MrHash avatar MrHash commented on July 16, 2024

So you cannot use the Doctrine ORM paginator because it is specific to the ORM. However i added an example for Pagerfanta and it is possible to use Zend Paginator or other generic pagination libraries in the same way.

from search.

MrHash avatar MrHash commented on July 16, 2024

Also another fork talkspirit@6ca22d9 has a paginator implementation but i'm not sure if it's necessary given that there are third party pagination libraries available.

from search.

pdrosos avatar pdrosos commented on July 16, 2024

Thank you very much for the example! I use Zend Framework 2 and MySQL database. Some of the searchable data is synchronized in ES. As far as I understand, I need to add all fields, which are used for filtering the data in ES too and make the filtering via the DoctrineSearch query, used in my Zend Paginator Adapter, not in the underlying Doctrine query, used for hydration the results, is this correct? Now the filtering conditions are in the Doctrine query, but if the paginator adapter uses the DoctrineSearch query it doesn't seem correct any more.

Thank you in advance for your help!

from search.

MrHash avatar MrHash commented on July 16, 2024

OK if you are using ES only for searching in combination with MySQL you can use the Doctrine\Search\Query::hydrateWith($doctrineQuery) technique as shown in the docs. This will select the items from your mysql database by id. In this case you can set source=false in your ElasticSearchable annotation.

If your results are different from doing a query on MySQL, then this is likely because ES has different techniques for storing tokens and doing queries. Have you checked your mappings and analyzers configuration in ES? Also the type of ES search query will vary results, e.g. Match, MultiMatch etc.

from search.

pdrosos avatar pdrosos commented on July 16, 2024

Yes, I am using ES only for searching and basically the data, needed for a full text search is currently synchronized with ES. I am using the Doctrine\Search\Query::hydrateWith($doctrineQuery) method. It seems to work fine.
My question is about the extra parameters I need to add to the query to filter the full text search results, returned from ES.
For example let's have Image with title and description. Title and description are in ES and are used for full text search. But the image has also isActive property and Creator, who has isActive property. I need to filter the ES results and get only the images which have isActive = true and Creator with isActive = true. These properties are not in ES but are added as Where conditions in the Doctrine hydration query.
Image and Creator have also other properties, needed for filtering the full text search results. Should I add them all in ES and filter the results in ES via the Elastica query, but not in MySQL with the Doctrine hydration query?

from search.

MrHash avatar MrHash commented on July 16, 2024

Since ES is doing your search job for you you should sync your Image and Creator properties to ES also and use the correct ES query to do all the search work, then simply use the ORM lookup hydration query as provided. In this case isActive could be type="boolean" and Creator type="string" index="not_analyzed" if it is an ID.

from search.

pdrosos avatar pdrosos commented on July 16, 2024

Great, thank you very much! It was important to clarify that it's not correct to use the Doctrine hydration query for additional filtering of the search results.

Have a nice day!

from search.

Related Issues (20)

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.