5 Replies Latest reply: May 31, 2012 6:26 AM by TomO_STM_2010 RSS

    Fix for SOLR searches beginning with wildcard?

    TomO_STM_2010 Community Member

      All, I am having problems finding clear answers on if the above was corrected in ColdFusion 10. 

       

      I can't get my head around the idea of SOLR not allowing search criteria to begin with a wildcard.  I've seen a solution for reverse wildcard searching, which is great as long as I specify criteria for which I know the ending letters.  For example, if I am looking for all entries ending in "ing", I could do a search on "*ing", using the reverse wildcard to find "gni*".  I have yet to see, or come up with, a solution for a SOLR search with wildcards in the start and end of the criteria.  For example, lets say I am looking for any word with "fus" in the middle, such as "confusing" or "perfusing" or "profusely".  I would want to do a search such as "*fus*".  From what I understand thus far, this cannot be done in SOLR?

       

      Thanks,

      Tom

        • 1. Re: Fix for SOLR searches beginning with wildcard?
          udayogra

          ColdFusion will support whatever Apache solr supports as it is the underlying engine we are using.

          Solr technically disables support of leading wildcards by default in the traditional query parsers due to concerns about query performance since it tends to select a large percentage of indexed terms.

           

          Uday Ogra

          ColdFusion Engineering Team

          • 2. Re: Fix for SOLR searches beginning with wildcard?
            Adam Cameron. Community Member

            ColdFusion will support whatever Apache solr supports as it is the underlying engine we are using.

             

            And Solr does support it: http://lucene.apache.org/solr/api/org/apache/solr/analysis/ReversedWildcardFilterFactory.h tml

             

            I think this is an egregious hack, but still, it's the way they've chosen to support it.

             

            Solr technically disables support of leading wildcards by default in the traditional query parsers due to concerns about query performance since it tends to select a large percentage of indexed terms.

             

            Be that as it may, this should be my decision, as the maintainer of the index, not your decision to blanketly disallow it.  If it's available, then one can use it if one choses, or not use it for the reasons you cite.  If you blanketly disallow it, you're removing the ability for me to make that decision.

             

            It's also a bit of a backwards compat issue, innit?  Verity allowed leading wildcards.

             

            --

            Adam

            • 3. Re: Fix for SOLR searches beginning with wildcard?
              udayogra Community Member

              If we google we can find hacks around it.

              And its not we who have decided to disallow it. It is Apache Solr's design.

              • 4. Re: Fix for SOLR searches beginning with wildcard?
                Adam Cameron. Community Member

                If we google we can find hacks around it.

                And its not we who have decided to disallow it. It is Apache Solr's design.

                 

                No, it's you who decided it by not integrating the wildcard filter as per my previous suggestion.

                 

                Equally, if you chose to upgrade your inbuilt search engine, you should make sure it's backwards compatible with the one it's replacing.  You so often claim that backwards compat is your "holy grail", after all.  Lucene / Solr do also provide mechanisms to extend the base engine as much as you want, so simply wrapping up the baseline and going "[shrug]: it's Apache's fault" doesn't stand up to too much scrutiny.

                 

                The functionality of the interface to Solr you expose via <cfindex> & <cfsearch> (etc) should have the same functionality - well: more, really - than that you provided for Verity.

                 

                --

                Adam

                • 5. Re: Fix for SOLR searches beginning with wildcard?
                  TomO_STM_2010 Community Member

                  Adam, thanks for your comments - I couldn't agree more.

                   

                  On a related note, I just realized there are schema.xml and solrconfig.xml files PER Solr collection.  I've not tried it yet, but I'm wondering if this is a means to customize the Solr search mechanics PER collection, e.g. to use or not use the ReversedWildcardFilterFactory?

                   

                  Anyone tried this?

                   

                  Thanks!

                  Tom