Solr advanced StopFilterFactory

I need advanced stop words filter in Solr.

We need stopwords to be stored in db and ability to change them by users (each user should have own stopwords). That's why I am thinking about sending stop words to solr from our app or connect to our db from solr and use updated stop words in custom StopFilterFactory.

Also each user will have own stopwords list which will be stored in mysql db "stopwords" table. (id, user_id, stopword).

We have next index structure. This index will store data for all users.

  <field name="user_id" type="int" indexed="true" stored="true" required="true" multiValued="false" />
  <field name="tag_name" type="text_general" indexed="true" stored="true" required="false" multiValued="false"/>
  ...
  <field name="tag_description" type="text_general" indexed="true" stored="true" required="false" multiValued="false"/>

I am not sure how to achive behaviour described above but I am thinking about writing own custom StopFilterFactory which will grab stopwords from db and use different stopwords for users while indexing their documents.

What you can suggest ? Is that possible ? Am I on right way ?

Answers


I don't think that querying a DB out of Solr to fetch stopword is a good idea.

Since Solr 4.8 there' a ManagedStopFilterFactory that might be interesting for you. It provides a REST API to manage stopwords. See this blogpost and this Jira ticket.

I'd create a small cronjob or a service that queries the DB and pushes the stopwords into Solr using the above mentioned REST API.

Providing different stopwords for each user seems like an odd approach to me, as you need either a separate index or field for each user.


Need Your Help

running a sudo command over j2ssh

java sudo j2ssh

I'm attempting to write some Java code that connects to a linux workstation, executes a command with sudo and then blocks until the command is complete.

How to create a EXCEPT Rewrite Rule at IIS

web-services iis ssl url-rewriting windows2012

I have a IIS Site with Rewrite Rule to redirect all requests to https.