0

I am trying to search field which has "\r\n" both together in the field.

I tried this query but it did not work:

fq
Field:"*\r\n*"

But this gives result along with field has "\" only. I just want result for which field contains whole "\r\n".

Dhwani
  • 7,484
  • 17
  • 78
  • 139
  • What is the type of the field you're searching? Indexing control characters might be a bit weird given all the different levels of encoding and analysis that happens – MatsLindh Jan 11 '23 at 19:52
  • @MatsLindh I am trying to search field which has multi-language data. It is a kind of long text. – Dhwani Jan 12 '23 at 07:34
  • That doesn't describe the _field type_ which is how the field will be analyzed. You might not have any tokens that contain newlines left after processing, which means that you won't be able to search for them regardless of what you do. In that case you'll want to have a `string` field - it'll keep anything explicitly as it is. But if this is a common task and not a one-off, resolve this at index time by having a second field named `contains_newlines` and just filter against that. You want to move as much as possible to the indexing step when working with document search engines. – MatsLindh Jan 12 '23 at 09:10
  • @MatsLindh We can't modify existing one. – Dhwani Jan 12 '23 at 12:08
  • If the content you're trying to match isn't in the index (since it has been removed by analysis), then you can't really make Solr search for it directly. You could try to do a streaming expression that matches against field values (which means that you still have to retrieve _every document_ in the index, or use the `/export` endpoint to retrieve all documents yourself and then match against that. You can use the `Analysis` page under Solr's Admin interface to see how your query and documents gets parsed into tokens, this will give you an idea what you can match against. – MatsLindh Jan 12 '23 at 12:09

0 Answers0