2012-05-11 24 views
6

के लिए केवल एक collation देता है मैं सौर 3.6 का उपयोग करता हूं और मैं बहु टर्म खोजों के लिए एक स्वत: पूर्ण समाधान के रूप में सुझावकर्ता से collations का उपयोग करना चाहता हूं। दुर्भाग्य से Suggester एक बहु अवधि की खोज के लिए केवल एक collation देता है, भले ही प्रत्येक एकल शब्द के लिए बहुत सारे सुझाव मौजूद हैं। मेरी परीक्षण खोजों और अंतर्निहित अनुक्रमित डेटा के आधार पर मुझे यकीन है कि अधिक collations मौजूद होना चाहिए।सोलर Suggester घटक

क्या मेरे सॉगेस्टर कॉन्फ़िगरेशन में कुछ गड़बड़ है? q = जैव + बेर के लिए

<!--configuration --> 
<searchComponent class="solr.SpellCheckComponent" name="suggest"> 
<lst name="spellchecker"> 
    <str name="name">suggest</str> 
    <str name="classname">org.apache.solr.spelling.suggest.Suggester</str> 
    <str name="lookupImpl">org.apache.solr.spelling.suggest.fst.WFSTLookupFactory</str> 
    <str name="field">text</str> <!-- the indexed field to derive suggestions from --> 
    <!--<float name="threshold">0.0005</float> disabled for test--> 
    <str name="buildOnCommit">true</str> 
</lst> 
</searchComponent> 

<requestHandler class="org.apache.solr.handler.component.SearchHandler" name="/suggest"> 
<lst name="defaults"> 
    <str name="spellcheck">true</str> 
    <str name="spellcheck.dictionary">suggest</str> 
    <str name="spellcheck.onlyMorePopular">true</str> 
    <str name="spellcheck.count">200</str> 
    <str name="spellcheck.collate">true</str> 
    <str name="spellcheck.maxCollations">10</str> 
</lst> 
<arr name="components"> 
    <str>suggest</str> 
</arr> 
</requestHandler> 

उदाहरण प्रतिक्रिया:

<response> 
<lst name="responseHeader"> 
    <int name="status">0</int> 
    <int name="QTime">4</int> 
</lst> 
<lst name="spellcheck"> 
    <lst name="suggestions"> 
     <lst name="bio"> 
      <int name="numFound">27</int> 
      <int name="startOffset">0</int> 
      <int name="endOffset">3</int> 
      <arr name="suggestion"> 
       <str>bio</str> 
       <str>bio-estetica</str> 
       <str>bio-kosmetik</str> 
            ... 
      </arr> 
     </lst> 
     <lst name="ber"> 
      <int name="numFound">81</int> 
      <int name="startOffset">4</int> 
      <int name="endOffset">7</int> 
      <arr name="suggestion"> 
       <str>beratung</str> 
       <str>bern</str> 
       ... 
      </arr> 
     </lst> 
     <str name="collation">bio beratung</str> 
    </lst> 
</lst> 
</response> 
+0

केवल मूल समाधान सॉकर खिलौना ऐप (start.jar) का उपयोग करके इस समस्या में भाग लें। मैंने spellcheck.maxCollations सहित वर्तनी जांच पैरामीटर के हर कल्पनीय संयोजन की कोशिश की, लेकिन एक से अधिक संयोजन प्राप्त नहीं कर पा रहे हैं। किसी भी अंतर्दृष्टि की सराहना की जाएगी। – nlawson

उत्तर

14

मैं आप के रूप में एक ही समस्या हो रही थी, और मैं इसे हल करने में कामयाब रहे। यह पता चला है कि कई कॉलेशन आपको सही तरीके से काम करने के लिए जानने के लिए आवश्यक हैं।

पहले, आप की components सूची के तहत एक QueryComponent निर्दिष्ट requestHandler "सुझाव है" अपने solrconfig.xml में होना आवश्यक है। अन्यथा आपके requestHandler को इंडेक्स से पूछताछ करने के बारे में पता नहीं है, इसलिए यह पता नहीं लगा सकता कि प्रत्येक सही क्वेरी में कितने हिट हैं, इसलिए आपको केवल एक ही प्राप्त होगा। अगर आपने अपनी क्वेरी में spellcheck.collateExtendedResults=true जोड़ा था, तो आपने देखा होगा कि hits 0 थे, जो दिखाता है कि सोलर ने इंडेक्स के खिलाफ सही क्वेरी की जांच करने के लिए परेशान नहीं किया था।

वे कुछ हद तक एक अपारदर्शी त्रुटि संदेश के साथ इस में संकेत: "। क्वेरी"

INFO: Could not find an instance of QueryComponent. Disabling collation verification against the index.

यह डिफ़ॉल्ट QueryComponent है, जो कहा जाता है का उपयोग करना है जोड़ने के लिए सबसे आसान तरीका तो एक्सएमएल आप ऊपर पोस्ट में, आप करने के लिए "घटक" भाग को बदल देंगे:

<arr name="components"> 
    <str>suggest</str> 
    <str>query</str> 
</arr> 

दूसरे, आप spellcheck.maxCollations सेट करने के लिए 1 से अधिक (डुह) होने की जरूरत है, और कम सहज, आप की जरूरत कुछ बड़ी संख्या (उदाहरण 1000) होने के लिए spellcheck.maxCollationTries सेट करने के लिए। यदि इनमें से कोई भी डिफ़ॉल्ट (दोनों 0) पर सेट है, तो सोलर केवल आपको एक संयोजन देगा। इसके अलावा, आप 1. से अधिक

तीसरे, आप क्वेरी को संशोधित करने के क्षेत्र आप के खिलाफ खोज करना चाहते हैं शामिल करने की जरूरत होने की spellcheck.count निर्धारित करने की आवश्यकता है, और शर्तों उचित मिलान सुनिश्चित करने के लिए उद्धरण से घिरा होना चाहिए। तो आपकी क्वेरी के मामले में:

q=bio+ber

यह वास्तव में होना चाहिए:

q=text:"bio+ber"

अपने मामले में जाहिर है

, "पाठ" डिफ़ॉल्ट क्षेत्र है, तो आप की जरूरत नहीं है यह। लेकिन मेरे मामले में, मैं एक गैर-डिफ़ॉल्ट फ़ील्ड का उपयोग कर रहा था, इसलिए मुझे इसे निर्दिष्ट करना पड़ा। अन्यथा, सोलर "टेक्स्ट" फ़ील्ड के खिलाफ हिट की गणना करेगा, और सभी परिणामों में 0 हिट होंगे, इसलिए रैंकिंग बेकार होगी।

तो मेरे मामले में, क्वेरी इस तरह देखा:

q=my_field:"brain+c" 
&spellcheck.count=5 
&spellcheck.maxCollations=10 
&spellcheck.maxCollationTries=1000 
&spellcheck.collateExtendedResults=true 

और मेरी प्रतिक्रिया इस तरह देखा:

<response> 
    <lst name="responseHeader"> 
    <int name="status">0</int> 
    <int name="QTime">4</int> 
    </lst> 
    <lst name="spellcheck"> 
    <lst name="suggestions"> 
     <lst name="brain"> 
     <int name="numFound">1</int> 
     <int name="startOffset">15</int> 
     <int name="endOffset">20</int> 
     <arr name="suggestion"> 
      <str>brain</str> 
     </arr> 
     </lst> 
     <lst name="c"> 
     <int name="numFound">4</int> 
     <int name="startOffset">21</int> 
     <int name="endOffset">23</int> 
     <arr name="suggestion"> 
      <str>cancer</str> 
      <str>cambrian</str> 
      <str>contusion</str> 
      <str>cells</str> 
     </arr> 
     </lst> 
     <lst name="collation"> 
     <str name="collationQuery">my_field:"brain cancer"</str> 
     <int name="hits">2</int> 
     <lst name="misspellingsAndCorrections"> 
      <str name="brain">brain</str> 
      <str name="c">cancer</str> 
     </lst> 
     </lst> 
     <lst name="collation"> 
     <str name="collationQuery">my_field:"brain contusion"</str> 
     <int name="hits">1</int> 
     <lst name="misspellingsAndCorrections"> 
      <str name="brain">brain</str> 
      <str name="c">contusion</str> 
     </lst> 
     </lst> 
     <lst name="collation"> 
     <str name="collationQuery">my_field:"brain cells"</str> 
     <int name="hits">1</int> 
     <lst name="misspellingsAndCorrections"> 
      <str name="brain">brain</str> 
      <str name="c">cells</str> 
     </lst> 
     </lst> 
    </lst> 
    </lst> 
    <result name="response" numFound="0" start="0"/> 
</response> 

सफलता!

+0

+1 इसने मुझे कोशिश करने के लिए कुछ चीजें दीं। – Aaron

+0

'@ nlawson': क्या आप इन त्रुटियों को हल करने में मदद करेंगे: [http://stackoverflow.com/questions/27502903/threshold-frequency-is-not-working-in-spell-check-in-solr] और [http : //stackoverflow.com/questions/27484326/getting-most-likely-documents-of-the-query-using-phonetic-filter-in-solr] – iNikkz

0

एक ही समस्या थी।

यह सोलर 3.6.1 का एक बग है (पिछले संस्करणों के बारे में निश्चित नहीं है)। कृपया जांचें: https://issues.apache.org/jira/browse/SOLR-2853

असल में इस टिप्पणी को प्रकाश डालता है: https://issues.apache.org/jira/browse/SOLR-2853?focusedCommentId=13136014&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13136014

एक संभावित समाधान, collations की संख्या आप की जरूरत के बराबर होना spellcheck.maxCollationTries निर्दिष्ट करने के लिए है, लेकिन वह भी खोज अनुक्रमणिका के खिलाफ उन collations जाँच करने के लिए Solr बाध्य करेगा। इसलिए इस संपत्ति को बड़ी संख्या में सेट करने के लिए सावधान रहें। इस परम पर अधिक: http://wiki.apache.org/solr/SpellCheckComponent#spellcheck.maxCollationTries

बग बंद नहीं है लेकिन पहले से ही पैच सबमिट किए गए हैं।

इसके अलावा मैंने सोलर 4.0.0-बीटा के कोड की जांच की है - ठीक पहले से ही है।

शुभकामनाएं सोलर्स!)