Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

How to use wildcards #35

Open
mads-hartmann opened this issue May 12, 2012 · 7 comments
Open

How to use wildcards #35

mads-hartmann opened this issue May 12, 2012 · 7 comments

Comments

@mads-hartmann
Copy link

Hi there,

How do I use wildcards? If I do something like the following:

val r = SolrBook where (_.title eqs "*game thr*")

then the wildcards gets escaped

r.meta.queryParams(r)
res13: Seq[(String, String)] = List((start,0), (rows,10), (q,title:("\*game thr\*")))
@holdenk
Copy link
Contributor

holdenk commented May 13, 2012

Hi mads379,

By default all of our queries are escaped, we have a representation in our AST for it but not in the query language its self right now. I'll add that.

Cheers,

Holden

@holdenk
Copy link
Contributor

holdenk commented May 13, 2012

Oh also, just a heads up that query is likely going to have terrible performance on Solr (front wildcards are slow). You might want to consider doing edgengram or ngram generation on a field if your going to be doing a lot of those types of queries.

@mads-hartmann
Copy link
Author

Oh, interesting. Would you be able to point me in the right direction (reading wise) on how to efficiently use solr to search the following: Given a partial book title (entered by the user), list all books with that title. That is, if I search for "game of" it should show "A Game of Thrones".

@holdenk
Copy link
Contributor

holdenk commented May 13, 2012

Well if you have tokenized your string (even with text_ws) "game of" will match "a game of thrones". You only really need the * if you were interested in "game of" matching "ninjagame ofthrones"

@mads-hartmann
Copy link
Author

The thing is I want to match a sentence, so if you search with "game of" it shouldn't accept "book of games".

I appreciate your help :)

/Mads

@holdenk
Copy link
Contributor

holdenk commented May 14, 2012

A phrase query should do just that, eqs gives you phrase style matching and contains gives you bag of words style matching.

@mads-hartmann
Copy link
Author

eqs query combined with EdgeNGramFilterFactory & LowerCaseFilterFactory gives me good results so far. This wildcard query issue isn't a priority for me anymore so you don't need to hurry for my sake.

Thanks,
Mads

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants