Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception in Search when query is "apache" or "java" #1

Closed
nicmarti opened this issue Mar 19, 2010 · 5 comments
Closed

Exception in Search when query is "apache" or "java" #1

nicmarti opened this issue Mar 19, 2010 · 5 comments

Comments

@nicmarti
Copy link

I installed successfully the Search module.

However, when I search for "apache" or "java", the following exception is thrown
Internal Server Error (500) for request GET /search?s=apache

Oops: UnexpectedException
An unexpected error occured caused by exception UnexpectedException: Unexpected Error

play.exceptions.UnexpectedException: Unexpected Error
at play.modules.search.Search$Query.fetch(Search.java:159)
at models.JobPost.search(JobPost.java:128)
at controllers.Application.search(Application.java:55)
at play.utils.Java.invokeStatic(Java.java:129)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:138)
at Invocation.HTTP Request(Play!)
Caused by: play.exceptions.UnexpectedException: Unexpected Error
at play.modules.search.Search$Query.executeQuery(Search.java:235)
at play.modules.search.Search$Query.fetch(Search.java:152)
... 5 more
Caused by: play.modules.search.Search$SearchException: Please re-index
at play.modules.search.Search$Query.executeQuery(Search.java:215)
... 6 more


If I search for "test" or "toto" it works like a charm.

Thanks for your help

Nicolas Martignole

@guillaumebort
Copy link

Hi,

I'm not totally sure, but I think this error is because your index contains some data that have been deleted from the database (an item has been found in the lucene index but does not exist in the database).

Perhaps you're using an old index, that you have created on your development host and that it not synchronized with the production database?

@guillaumebort
Copy link

So pehaps you should just call Search.reindex in a job (for example in a @OnApplicationStart job, this way your index would be correctly synchronized at each application start)

@jfp
Copy link
Owner

jfp commented Mar 19, 2010

Hi,

The module maintains a Lucene index per class. When you're making a full text query, the index will return a collection of JPA object id matching your search, and try to load them from the DB. The error you're reporting occurs when the object is in the index but not in the DB anymore. This might happen in dev mode, likely if you clear your database using fixtures ou direct JDBC.

As Guillaume said, you can call Search.reindex whenever you want, il will cause the index to be deleted and re-created using the data in your DB. You can also simply add
play.search.reindex=true
in your conf/application.conf file and restart your app to have it re-indexed.

@jfp
Copy link
Owner

jfp commented Mar 29, 2010

Should be okay now

@nicmarti
Copy link
Author

Yes, fixed. The error was due to an invalid Lucene index, after adding a new field in my Entity. Sorry for the late notice.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants