netzding
netzding

Reputation: 777

How to perform LIKE in SolrQuery on a single string

We have a field "url" with a link in it.

For example:

https://www.domain.de/g/t/h-zu-b

I need to find all documents with a specific domain.

For example:

https://www.foo.bar ...

So in my database mind I would perform a LIKE-Query to achieve that. but in the context of Solr I'm pretty lost and would be very interested in how that would work?

Upvotes: 1

Views: 49

Answers (1)

Hector Correa
Hector Correa

Reputation: 26690

You should be able to emulate the LIKE query via a regular expression, for example:

url:/http\:\/\/www\.foo\.bar.*/

A couple of caveats:

  • Make sure you encode the special characters(: . /)
  • RegEx searchers are slow
  • Make sure your url field is indexed

Upvotes: 1

Related Questions