[ 
https://issues.apache.org/jira/browse/SOLR-3700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13431873#comment-13431873
 ] 

Robert Muir commented on SOLR-3700:
-----------------------------------

in trainVocabulary:
{code}
TopDocs topDocs = indexSearcher.search(new MatchAllDocsQuery(), 
Integer.MAX_VALUE);
{code}

Thats gonna be really slow if the goal is simply to iterate over all documents.
I would just grab indexSearcher.getIndexReader() and loop until maxDoc(), rather
than scoring in a massive priority queue.

in tokenizeDoc:
{code}
TokenStream tokenStream = analyzer.tokenStream(textFieldName, new 
StringReader(doc));
while (tokenStream.incrementToken()) {
  CharTermAttribute charTermAttribute = 
tokenStream.getAttribute(CharTermAttribute.class);
  result.add(charTermAttribute.toString());
}
{code}

this should use the mandatory reset() etc methods, otherwise its not safe, so 
something like:
{code}
TokenStream tokenStream = analyzer.tokenStream(textFieldName, new 
StringReader(doc));
CharTermAttribute charTermAttribute = 
tokenStream.addAttribute(CharTermAttribute.class);
tokenStream.reset();
while (tokenStream.incrementToken()) {
  result.add(charTermAttribute.toString());
}
tokenStream.end();
tokenStream.close();
{code}

If you change the test's analyzer from WhitespaceTokenizerFactory to 
MockTokenizerFactory,
it should check for these things and currently fail, so thats an easy way to 
test :)

                
> Create a Classification component
> ---------------------------------
>
>                 Key: SOLR-3700
>                 URL: https://issues.apache.org/jira/browse/SOLR-3700
>             Project: Solr
>          Issue Type: New Feature
>            Reporter: Tommaso Teofili
>            Priority: Minor
>         Attachments: SOLR-3700.patch
>
>
> Lucene/Solr can host huge sets of documents containing lots of information in 
> fields so that these can be used as training examples (w/ features) in order 
> to very quickly create classifiers algorithms to use on new documents and / 
> or to provide an additional service.
> So the idea is to create a contrib module (called 'classification') to host a 
> ClassificationComponent that will use already seen data (the indexed 
> documents / fields) to classify new documents / text fragments.
> The first version will contain a (simplistic) Lucene based Naive Bayes 
> classifier but more implementations should be added in the future.

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

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to