lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From MitchK <mitc...@web.de>
Subject Is this a bug of the RessourceLoader?
Date Thu, 01 Apr 2010 11:06:13 GMT

Hello community,

I was hunting a ghostbug the last few days. As some of you might have
recognized, I have written some postings, because of unexpected
dismax-handler behaviour and some other problems. However, there was no
error in my code nor in my schema.xml. 

It seems like that the ressource-loader has got a little bug. The first line
of a file you want to load with the getLine()-method of RessourceLoader [1]
has to be outcommented by "#". If not, the first line seems to be ignored or
something like that. 

Please let me know, whether you can reproduce this bug on your own. The
responsible code was copied from the StopWordFilter and looks like that:
------------------------------------
//copied from StopFilterFactory and some vars are renamed
		if (wordsFile != null) 
		{
			try {
					List<String> files = StrUtils.splitFileNames(wordsFile);
					if (words == null && files.size() > 0)
					{
						//default stopwords list has 35 or so words, but maybe don't make it
that big to start
						words = new CharArraySet(files.size() * 10, true);
					}
					for (String file : files) 
					{
						List<String> wlist = loader.getLines(file.trim());
						//TODO: once StopFilter.makeStopSet(List) method is available, switch
to using that so we can avoid a toArray() call
						words.addAll(StopFilter.makeStopSet((String[])wlist.toArray(new
String[0]), true));
					}
		      } catch (IOException e) 
		      {
		        throw new RuntimeException(e);
		      }
		} 
------------------------------------------



If you can reproduce this error, I think one should note it in the javadocs,
because bypassing this unexpected behaviour seems to be easy: just
outcomment the first line with a "#"-character.


Hope this helps
- Mitch

[1]
http://lucene.apache.org/solr/api/org/apache/solr/common/ResourceLoader.html
-- 
View this message in context: http://n3.nabble.com/Is-this-a-bug-of-the-RessourceLoader-tp690523p690523.html
Sent from the Solr - User mailing list archive at Nabble.com.

Mime
View raw message