Different search term on different fields using edismax query parser in solr











up vote
0
down vote

favorite












I have a solr query that searches on multiple fields. To increase the recall, I also do wildcard and fuzzy query. I use edismax query parser because I also have to use boost function.



Here is the relevant parts of the query:



defType=edismax&q= (wine AND company) OR  (wine* AND company*)^0.5  OR (wine* OR company*)^0.01 OR (wine~1 AND company~1)^0.02&qf=primary_tags^1 secondary_tags_s^0.2 merchant_name_s^0.5


Now, the above query searches for (wine AND company) OR (wine* AND company*)^0.5 OR (wine* OR company*)^0.01 OR (wine~1 AND company~1)^0.02 on all the fields primary_tags^1 secondary_tags_s^0.2 merchant_name_s^0.5, but what I want is that (wine AND company) should only be searched on merchant_name_s^0.5, (wine* AND company*)^0.5 OR (wine* OR company*)^0.01 on primary_tags^1 and (wine~1 AND company~1)^0.02 on secondary_tags_s^0.2.



What would be the correct way to achieve that?










share|improve this question


























    up vote
    0
    down vote

    favorite












    I have a solr query that searches on multiple fields. To increase the recall, I also do wildcard and fuzzy query. I use edismax query parser because I also have to use boost function.



    Here is the relevant parts of the query:



    defType=edismax&q= (wine AND company) OR  (wine* AND company*)^0.5  OR (wine* OR company*)^0.01 OR (wine~1 AND company~1)^0.02&qf=primary_tags^1 secondary_tags_s^0.2 merchant_name_s^0.5


    Now, the above query searches for (wine AND company) OR (wine* AND company*)^0.5 OR (wine* OR company*)^0.01 OR (wine~1 AND company~1)^0.02 on all the fields primary_tags^1 secondary_tags_s^0.2 merchant_name_s^0.5, but what I want is that (wine AND company) should only be searched on merchant_name_s^0.5, (wine* AND company*)^0.5 OR (wine* OR company*)^0.01 on primary_tags^1 and (wine~1 AND company~1)^0.02 on secondary_tags_s^0.2.



    What would be the correct way to achieve that?










    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I have a solr query that searches on multiple fields. To increase the recall, I also do wildcard and fuzzy query. I use edismax query parser because I also have to use boost function.



      Here is the relevant parts of the query:



      defType=edismax&q= (wine AND company) OR  (wine* AND company*)^0.5  OR (wine* OR company*)^0.01 OR (wine~1 AND company~1)^0.02&qf=primary_tags^1 secondary_tags_s^0.2 merchant_name_s^0.5


      Now, the above query searches for (wine AND company) OR (wine* AND company*)^0.5 OR (wine* OR company*)^0.01 OR (wine~1 AND company~1)^0.02 on all the fields primary_tags^1 secondary_tags_s^0.2 merchant_name_s^0.5, but what I want is that (wine AND company) should only be searched on merchant_name_s^0.5, (wine* AND company*)^0.5 OR (wine* OR company*)^0.01 on primary_tags^1 and (wine~1 AND company~1)^0.02 on secondary_tags_s^0.2.



      What would be the correct way to achieve that?










      share|improve this question













      I have a solr query that searches on multiple fields. To increase the recall, I also do wildcard and fuzzy query. I use edismax query parser because I also have to use boost function.



      Here is the relevant parts of the query:



      defType=edismax&q= (wine AND company) OR  (wine* AND company*)^0.5  OR (wine* OR company*)^0.01 OR (wine~1 AND company~1)^0.02&qf=primary_tags^1 secondary_tags_s^0.2 merchant_name_s^0.5


      Now, the above query searches for (wine AND company) OR (wine* AND company*)^0.5 OR (wine* OR company*)^0.01 OR (wine~1 AND company~1)^0.02 on all the fields primary_tags^1 secondary_tags_s^0.2 merchant_name_s^0.5, but what I want is that (wine AND company) should only be searched on merchant_name_s^0.5, (wine* AND company*)^0.5 OR (wine* OR company*)^0.01 on primary_tags^1 and (wine~1 AND company~1)^0.02 on secondary_tags_s^0.2.



      What would be the correct way to achieve that?







      solr edismax






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 22 hours ago









      vishalaksh

      65921228




      65921228
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          edismax supports the full Lucene syntax.



          q=merchant_name:(wine AND company)^0.5 primary_tags:(wine* AND company*)^0.5 primary_tags:(wine* OR company*)^0.01 secondary_tags_s:(wine~1 AND company~1)^0.0004


          should be about the same query you've described. I've combined the secondary_tags_s part into one single weight and seprated the primary_tags clauses, since the default behavior is OR between the terms anyway (depending on q.op).






          share|improve this answer





















            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














             

            draft saved


            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53371028%2fdifferent-search-term-on-different-fields-using-edismax-query-parser-in-solr%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            0
            down vote













            edismax supports the full Lucene syntax.



            q=merchant_name:(wine AND company)^0.5 primary_tags:(wine* AND company*)^0.5 primary_tags:(wine* OR company*)^0.01 secondary_tags_s:(wine~1 AND company~1)^0.0004


            should be about the same query you've described. I've combined the secondary_tags_s part into one single weight and seprated the primary_tags clauses, since the default behavior is OR between the terms anyway (depending on q.op).






            share|improve this answer

























              up vote
              0
              down vote













              edismax supports the full Lucene syntax.



              q=merchant_name:(wine AND company)^0.5 primary_tags:(wine* AND company*)^0.5 primary_tags:(wine* OR company*)^0.01 secondary_tags_s:(wine~1 AND company~1)^0.0004


              should be about the same query you've described. I've combined the secondary_tags_s part into one single weight and seprated the primary_tags clauses, since the default behavior is OR between the terms anyway (depending on q.op).






              share|improve this answer























                up vote
                0
                down vote










                up vote
                0
                down vote









                edismax supports the full Lucene syntax.



                q=merchant_name:(wine AND company)^0.5 primary_tags:(wine* AND company*)^0.5 primary_tags:(wine* OR company*)^0.01 secondary_tags_s:(wine~1 AND company~1)^0.0004


                should be about the same query you've described. I've combined the secondary_tags_s part into one single weight and seprated the primary_tags clauses, since the default behavior is OR between the terms anyway (depending on q.op).






                share|improve this answer












                edismax supports the full Lucene syntax.



                q=merchant_name:(wine AND company)^0.5 primary_tags:(wine* AND company*)^0.5 primary_tags:(wine* OR company*)^0.01 secondary_tags_s:(wine~1 AND company~1)^0.0004


                should be about the same query you've described. I've combined the secondary_tags_s part into one single weight and seprated the primary_tags clauses, since the default behavior is OR between the terms anyway (depending on q.op).







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 22 hours ago









                MatsLindh

                24.2k22240




                24.2k22240






























                     

                    draft saved


                    draft discarded



















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53371028%2fdifferent-search-term-on-different-fields-using-edismax-query-parser-in-solr%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Saint-Aignan (Tarn-et-Garonne)

                    Volksrepublik China

                    How to test boost logger output in unit testing?