Exact matches vs any word matches
-
pgilpatParticipant1 year, 7 months ago #28151
We have updated the configuration in Schema.XML and added hook that used to update the Solr query in ajax_solr_services.
Because of changes we added, the any words match are working fine and for exact match returns the empty content, only returns results for some words.
Note : only some words are working fine for exact match (Not at all).If we comment the query_exact in the added hook means the results return from exact match and any words match are same.
Here is some example words which returns results as expected for exact match :
god, love, man, soul, mind, mortal – working fine for exact match.
https://tbwp.hostworks.com/search-wpsolr/?wpsolr_sort=sort_by_menu_order_as…Not working examples for exact match:
Supreme, divine, quote, – Not working for exact match
https://tbwp.hostworks.com/search-wpsolr/?search=%22quote%22Need to check with wpsolr that why its not working for exact match.
Here below attached the added configuration in Schema and hooks.
wpsolrKeymaster1 year, 7 months ago #28156To understand how a sentence is analysed for your field : https://solr.apache.org/guide/8_10/analysis-screen.html
prakashreddy.imduriParticipant7 months, 1 week ago #31365Can you release this feature in next version ?
prakashreddy.imduriParticipant7 months, 1 week ago #31369I have same kind of requirement, I added copyfields, and also used this function
use Solarium\QueryType\Select\Query\Query;add_action( WPSOLR_Events::WPSOLR_ACTION_SOLARIUM_QUERY, [$this, ‘wpsolr_action_query’,], 10, 1 );
I am getting error for using $this,
“Uncaught Error: Using $this when not in object context”
Can you tell me how exactly to use this, as you specified to use this in custom class.. Can you elaborate more.prakashreddy.imduriParticipant7 months, 1 week ago #31392Hi, I tried it without $this, getting this errors:
Uncaught Error: syntax error, unexpected ‘public’ (T_PUBLIC), expecting end of file [if used without class]
Fatal error: Uncaught Error: Call to a member function getQuery() on array
Here is my code : I didnt add class here, but its there in actual codeuse Solarium\QueryType\Select\Query\Query; add_action( WPSOLR_Events::WPSOLR_ACTION_SOLARIUM_QUERY, 'wpsolr_action_query', 10, 1 ); function wpsolr_action_query( $parameters ) { if ($_GET['s'] == "") { return; } $solarium_query = $parameters[ WPSOLR_Events::WPSOLR_ACTION_SOLARIUM_QUERY__PARAM_SOLARIUM_QUERY ]; $query = $solarium_query->getQuery(); $query_exact = $_GET['s']; $query = $solarium_query->setQuery($query_exact); }
- This reply was modified 7 months, 1 week ago by prakashreddy.imduri.
- This reply was modified 7 months, 1 week ago by prakashreddy.imduri.
prakashreddy.imduriParticipant7 months, 1 week ago #31395Also, as this schema is not related to elastic search it seems,
<copyField source="title" dest="text_exact"/> <copyField source="tags" dest="text_exact"/> <copyField source="categories" dest="text_exact"/> <copyField source="content" dest="text_exact"/> <copyField source="permalink" dest="text_exact"/> <copyField source="comments" dest="text_exact"/>
can you tell me how to implement exact match search for elastic index ?
You must be logged in to reply to this topic.