You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucenenet.apache.org by "IT-Servives Polenz (JIRA)" <ji...@apache.org> on 2007/01/16 17:11:27 UTC

[jira] Created: (LUCENENET-32) Check hashtable in PhraseQuery.ExtractTerms for existing keys

Check hashtable in PhraseQuery.ExtractTerms for existing keys
-------------------------------------------------------------

                 Key: LUCENENET-32
                 URL: https://issues.apache.org/jira/browse/LUCENENET-32
             Project: Lucene.Net
          Issue Type: Task
            Reporter: IT-Servives Polenz


It can happen by accident, that an search term exist twice in a query.
If so, Lucene.Net fails with the exception, e.g. 

Item has already been added. Key in dictionary: 'Text:money' Key being added: 'Text:money'
StackTrace
at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add)
at System.Collections.Hashtable.Add(Object key, Object value)
at Lucene.Net.Search.PhraseQuery.ExtractTerms(Hashtable queryTerms)
at Lucene.Net.Search.BooleanQuery.ExtractTerms(Hashtable terms)
at Lucene.Net.Highlight.QueryTermExtractor.GetTerms(Query query, Hashtable terms, Boolean prohibited, String fieldName)
at Lucene.Net.Highlight.QueryTermExtractor.GetTerms(Query query, Boolean prohibited, String fieldName)
at Lucene.Net.Highlight.QueryScorer..ctor(Query query)

You should just adopt the method by adding a check whether the key already exists in your inner hashtable.
This is nothing a Lucene user could handle before sending the query into Lucene, simply because it's unneccesary work to implement a check of the search phrase before.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (LUCENENET-32) Check hashtable in PhraseQuery.ExtractTerms for existing keys

Posted by "Doug (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENENET-32?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12478969 ] 

Doug commented on LUCENENET-32:
-------------------------------

This affects:
  PhraseQuery.cs(288): queryTerms.Add(term, term);
  TermQuery.cs(174): terms.Add(term, term);

SpanTermQuery.cs(154) is not affected because it is wrapped by 
              if (terms.Contains(term) == false)


Applying this to TermQuery.cs fixes the problem.


> Check hashtable in PhraseQuery.ExtractTerms for existing keys
> -------------------------------------------------------------
>
>                 Key: LUCENENET-32
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-32
>             Project: Lucene.Net
>          Issue Type: Task
>            Reporter: IT-Servives Polenz
>
> It can happen by accident, that an search term exist twice in a query.
> If so, Lucene.Net fails with the exception, e.g. 
> Item has already been added. Key in dictionary: 'Text:money' Key being added: 'Text:money'
> StackTrace
> at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add)
> at System.Collections.Hashtable.Add(Object key, Object value)
> at Lucene.Net.Search.PhraseQuery.ExtractTerms(Hashtable queryTerms)
> at Lucene.Net.Search.BooleanQuery.ExtractTerms(Hashtable terms)
> at Lucene.Net.Highlight.QueryTermExtractor.GetTerms(Query query, Hashtable terms, Boolean prohibited, String fieldName)
> at Lucene.Net.Highlight.QueryTermExtractor.GetTerms(Query query, Boolean prohibited, String fieldName)
> at Lucene.Net.Highlight.QueryScorer..ctor(Query query)
> You should just adopt the method by adding a check whether the key already exists in your inner hashtable.
> This is nothing a Lucene user could handle before sending the query into Lucene, simply because it's unneccesary work to implement a check of the search phrase before.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LUCENENET-32) Check hashtable in PhraseQuery.ExtractTerms for existing keys

Posted by "Jean-Baptiste Huber (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENENET-32?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12478734 ] 

Jean-Baptiste Huber commented on LUCENENET-32:
----------------------------------------------

It seems the problem comes from a wrong port from Java to .NET.
In Java, the method extractTerms uses the interface Set which corresponds more to ArrayList than to Hashtable. Nevertheless, contrary to the Java class Set, ArrayList requires to check that the item is not already present before adding.


> Check hashtable in PhraseQuery.ExtractTerms for existing keys
> -------------------------------------------------------------
>
>                 Key: LUCENENET-32
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-32
>             Project: Lucene.Net
>          Issue Type: Task
>            Reporter: IT-Servives Polenz
>
> It can happen by accident, that an search term exist twice in a query.
> If so, Lucene.Net fails with the exception, e.g. 
> Item has already been added. Key in dictionary: 'Text:money' Key being added: 'Text:money'
> StackTrace
> at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add)
> at System.Collections.Hashtable.Add(Object key, Object value)
> at Lucene.Net.Search.PhraseQuery.ExtractTerms(Hashtable queryTerms)
> at Lucene.Net.Search.BooleanQuery.ExtractTerms(Hashtable terms)
> at Lucene.Net.Highlight.QueryTermExtractor.GetTerms(Query query, Hashtable terms, Boolean prohibited, String fieldName)
> at Lucene.Net.Highlight.QueryTermExtractor.GetTerms(Query query, Boolean prohibited, String fieldName)
> at Lucene.Net.Highlight.QueryScorer..ctor(Query query)
> You should just adopt the method by adding a check whether the key already exists in your inner hashtable.
> This is nothing a Lucene user could handle before sending the query into Lucene, simply because it's unneccesary work to implement a check of the search phrase before.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (LUCENENET-32) Check hashtable in PhraseQuery.ExtractTerms for existing keys

Posted by "George Aroush (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENENET-32?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

George Aroush closed LUCENENET-32.
----------------------------------

    Resolution: Fixed

> Check hashtable in PhraseQuery.ExtractTerms for existing keys
> -------------------------------------------------------------
>
>                 Key: LUCENENET-32
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-32
>             Project: Lucene.Net
>          Issue Type: Task
>            Reporter: IT-Servives Polenz
>         Assigned To: George Aroush
>
> It can happen by accident, that an search term exist twice in a query.
> If so, Lucene.Net fails with the exception, e.g. 
> Item has already been added. Key in dictionary: 'Text:money' Key being added: 'Text:money'
> StackTrace
> at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add)
> at System.Collections.Hashtable.Add(Object key, Object value)
> at Lucene.Net.Search.PhraseQuery.ExtractTerms(Hashtable queryTerms)
> at Lucene.Net.Search.BooleanQuery.ExtractTerms(Hashtable terms)
> at Lucene.Net.Highlight.QueryTermExtractor.GetTerms(Query query, Hashtable terms, Boolean prohibited, String fieldName)
> at Lucene.Net.Highlight.QueryTermExtractor.GetTerms(Query query, Boolean prohibited, String fieldName)
> at Lucene.Net.Highlight.QueryScorer..ctor(Query query)
> You should just adopt the method by adding a check whether the key already exists in your inner hashtable.
> This is nothing a Lucene user could handle before sending the query into Lucene, simply because it's unneccesary work to implement a check of the search phrase before.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (LUCENENET-32) Check hashtable in PhraseQuery.ExtractTerms for existing keys

Posted by "George Aroush (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENENET-32?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

George Aroush reassigned LUCENENET-32:
--------------------------------------

    Assignee: George Aroush

> Check hashtable in PhraseQuery.ExtractTerms for existing keys
> -------------------------------------------------------------
>
>                 Key: LUCENENET-32
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-32
>             Project: Lucene.Net
>          Issue Type: Task
>            Reporter: IT-Servives Polenz
>         Assigned To: George Aroush
>
> It can happen by accident, that an search term exist twice in a query.
> If so, Lucene.Net fails with the exception, e.g. 
> Item has already been added. Key in dictionary: 'Text:money' Key being added: 'Text:money'
> StackTrace
> at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add)
> at System.Collections.Hashtable.Add(Object key, Object value)
> at Lucene.Net.Search.PhraseQuery.ExtractTerms(Hashtable queryTerms)
> at Lucene.Net.Search.BooleanQuery.ExtractTerms(Hashtable terms)
> at Lucene.Net.Highlight.QueryTermExtractor.GetTerms(Query query, Hashtable terms, Boolean prohibited, String fieldName)
> at Lucene.Net.Highlight.QueryTermExtractor.GetTerms(Query query, Boolean prohibited, String fieldName)
> at Lucene.Net.Highlight.QueryScorer..ctor(Query query)
> You should just adopt the method by adding a check whether the key already exists in your inner hashtable.
> This is nothing a Lucene user could handle before sending the query into Lucene, simply because it's unneccesary work to implement a check of the search phrase before.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Reopened: (LUCENENET-32) Check hashtable in PhraseQuery.ExtractTerms for existing keys

Posted by "George Aroush (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENENET-32?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

George Aroush reopened LUCENENET-32:
------------------------------------


> Check hashtable in PhraseQuery.ExtractTerms for existing keys
> -------------------------------------------------------------
>
>                 Key: LUCENENET-32
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-32
>             Project: Lucene.Net
>          Issue Type: Task
>            Reporter: IT-Servives Polenz
>         Assigned To: George Aroush
>
> It can happen by accident, that an search term exist twice in a query.
> If so, Lucene.Net fails with the exception, e.g. 
> Item has already been added. Key in dictionary: 'Text:money' Key being added: 'Text:money'
> StackTrace
> at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add)
> at System.Collections.Hashtable.Add(Object key, Object value)
> at Lucene.Net.Search.PhraseQuery.ExtractTerms(Hashtable queryTerms)
> at Lucene.Net.Search.BooleanQuery.ExtractTerms(Hashtable terms)
> at Lucene.Net.Highlight.QueryTermExtractor.GetTerms(Query query, Hashtable terms, Boolean prohibited, String fieldName)
> at Lucene.Net.Highlight.QueryTermExtractor.GetTerms(Query query, Boolean prohibited, String fieldName)
> at Lucene.Net.Highlight.QueryScorer..ctor(Query query)
> You should just adopt the method by adding a check whether the key already exists in your inner hashtable.
> This is nothing a Lucene user could handle before sending the query into Lucene, simply because it's unneccesary work to implement a check of the search phrase before.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (LUCENENET-32) Check hashtable in PhraseQuery.ExtractTerms for existing keys

Posted by "George Aroush (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENENET-32?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

George Aroush resolved LUCENENET-32.
------------------------------------

    Resolution: Fixed

Fixed for Apache Lucene.Net 2.0 build 004

> Check hashtable in PhraseQuery.ExtractTerms for existing keys
> -------------------------------------------------------------
>
>                 Key: LUCENENET-32
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-32
>             Project: Lucene.Net
>          Issue Type: Task
>            Reporter: IT-Servives Polenz
>         Assigned To: George Aroush
>
> It can happen by accident, that an search term exist twice in a query.
> If so, Lucene.Net fails with the exception, e.g. 
> Item has already been added. Key in dictionary: 'Text:money' Key being added: 'Text:money'
> StackTrace
> at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add)
> at System.Collections.Hashtable.Add(Object key, Object value)
> at Lucene.Net.Search.PhraseQuery.ExtractTerms(Hashtable queryTerms)
> at Lucene.Net.Search.BooleanQuery.ExtractTerms(Hashtable terms)
> at Lucene.Net.Highlight.QueryTermExtractor.GetTerms(Query query, Hashtable terms, Boolean prohibited, String fieldName)
> at Lucene.Net.Highlight.QueryTermExtractor.GetTerms(Query query, Boolean prohibited, String fieldName)
> at Lucene.Net.Highlight.QueryScorer..ctor(Query query)
> You should just adopt the method by adding a check whether the key already exists in your inner hashtable.
> This is nothing a Lucene user could handle before sending the query into Lucene, simply because it's unneccesary work to implement a check of the search phrase before.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.