Exact matches vs any word matches

Tagged:
  • pgilpat
    Participant
    2 years, 6 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%22

    Need to check with wpsolr that why its not working for exact match.

    Here below attached the added configuration in Schema and hooks.

    pgilpat
    Participant
    2 years, 6 months ago #28153

    Field exact.png
    fieldtype.png
    copyfield.png
    hook.png

    wpsolr
    Keymaster
    2 years, 6 months ago #28154

    I suggest to execute your Solr queries manually in the Solr admin with the debugger on.

    pgilpat
    Participant
    2 years, 6 months ago #28155

    How do we do that?

    wpsolr
    Keymaster
    2 years, 6 months ago #28156

    To understand how a sentence is analysed for your field : https://solr.apache.org/guide/8_10/analysis-screen.html

    pgilpat
    Participant
    2 years, 6 months ago #28157

    I’ve past to developers, but I don’t understand how this will help.

    wpsolr
    Keymaster
    2 years, 6 months ago #28158

    If you enter your keywords in the analysis screen, on your new text field, it will show you if transformations are applied to your keywords, at index time or at query time.

    1 year, 6 months ago #31365

    Can you release this feature in next version ?

    1 year, 6 months ago #31369

    I 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.

    wpsolr
    Keymaster
    1 year, 6 months ago #31370

    Try without a $this: add_action( WPSOLR_Events::WPSOLR_ACTION_SOLARIUM_QUERY, ‘wpsolr_action_query’, 10, 1 );

    1 year, 6 months ago #31392

    Hi, 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 code

    use 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);
    }
    1 year, 6 months ago #31395

    Also, 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 ?

    wpsolr
    Keymaster
    1 year, 6 months ago #31396

    This is a feature that the plugin does not provide, out of this support help.

Viewing 13 posts - 31 through 43 (of 43 total)

You must be logged in to reply to this topic.