You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by rajam <rx...@portaltech.net> on 2009/04/23 14:14:08 UTC
Synonym file in a different location
Hi All,
I am trying to use synonyms in my project.
I would like to know whether it is possible to pick the synonyms.txt file
from a configurable location.
Ideally I would like to specify the location in a properties file and make
solr read it to load the synonyms file.
Could any one please let me know how we can achieve this?
Thanks in advance.
Regards,
Raja
--
View this message in context: http://www.nabble.com/Synonym-file-in-a-different-location-tp23195669p23195669.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Synonym file in a different location or loading synonyms from
database
Posted by rajam <rx...@portaltech.net>.
Thanks Otis.
I tried putting the absolute path and it worked. But I wanted something
configurable so that it can be changed if required.(may be thro an admin
interface?)
In the mean time, another idea stuck to maintain all the synonyms in
database. I tried writing a FilterFactory of my own for creating the
SynonymMap and SynonymFilter. I couldn't get this working and getting
NullPointerException as in the stack trace below.
21:16:10,921 ERROR [STDERR] 23-Apr-2009 21:16:10
org.apache.solr.common.SolrException log
SEVERE: java.lang.NullPointerException
at
org.apache.solr.analysis.SynonymFilter.next(SynonymFilter.java:79)
at org.apache.lucene.analysis.StopFilter.next(StopFilter.java:120)
at
org.apache.solr.analysis.WordDelimiterFilter.next(WordDelimiterFilter.java:272)
at
org.apache.lucene.analysis.LowerCaseFilter.next(LowerCaseFilter.java:34)
at
org.apache.solr.analysis.EnglishPorterFilter.next(EnglishPorterFilterFactory.java:106)
at org.apache.lucene.analysis.TokenStream.next(TokenStream.java:47)
at
org.apache.solr.analysis.BufferedTokenStream.read(BufferedTokenStream.java:94)
at
org.apache.solr.analysis.BufferedTokenStream.next(BufferedTokenStream.java:80)
at org.apache.lucene.analysis.TokenStream.next(TokenStream.java:91)
at
org.apache.lucene.queryParser.QueryParser.getFieldQuery(QueryParser.java:519)
at
org.apache.solr.search.SolrQueryParser.getFieldQuery(SolrQueryParser.java:116)
at
org.apache.lucene.queryParser.QueryParser.Term(QueryParser.java:1324)
at
org.apache.lucene.queryParser.QueryParser.Clause(QueryParser.java:1211)
at
org.apache.lucene.queryParser.QueryParser.Query(QueryParser.java:1139)
at
org.apache.lucene.queryParser.QueryParser.TopLevelQuery(QueryParser.java:1128)
at
org.apache.lucene.queryParser.QueryParser.parse(QueryParser.java:170)
at
org.apache.solr.search.LuceneQParser.parse(LuceneQParserPlugin.java:79)
at
org.apache.solr.search.OldLuceneQParser.parse(LuceneQParserPlugin.java:119)
at org.apache.solr.search.QParser.getQuery(QParser.java:88)
at
org.apache.solr.handler.component.QueryComponent.prepare(QueryComponent.java:82)
It looks like I am missing some configuration and solr is not updating the
SynonymMap or SynonymFilter when my factory class is invoked. But I am sure
that my factory class is invoked.
In the schema.xml, I updated the index analyzer as
<filter class="custom class" synonyms="synonyms.txt" ignoreCase="true"
expand="false"/>
The query analyzer is updated as
<filter class="custom class" synonyms="synonyms.txt" ignoreCase="true"
expand="true"/>
Is there any thing which is obvious that's missed?
Regards,
Raja
--
View this message in context: http://www.nabble.com/Synonym-file-in-a-different-location-tp23195669p23200257.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Synonym file in a different location
Posted by Otis Gospodnetic <ot...@yahoo.com>.
Hi Raja,
Try putting the absolute path to the synonyms file in the schema.xml. If that doesn't work you can always just use 'ln': http://unixhelp.ed.ac.uk/CGI/man-cgi?ln
Otis
--
Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch
----- Original Message ----
> From: rajam <rx...@portaltech.net>
> To: solr-user@lucene.apache.org
> Sent: Thursday, April 23, 2009 8:14:08 AM
> Subject: Synonym file in a different location
>
>
> Hi All,
> I am trying to use synonyms in my project.
> I would like to know whether it is possible to pick the synonyms.txt file
> from a configurable location.
> Ideally I would like to specify the location in a properties file and make
> solr read it to load the synonyms file.
>
> Could any one please let me know how we can achieve this?
>
> Thanks in advance.
>
> Regards,
> Raja
>
> --
> View this message in context:
> http://www.nabble.com/Synonym-file-in-a-different-location-tp23195669p23195669.html
> Sent from the Solr - User mailing list archive at Nabble.com.