0

I would like to query in my Solr 7 interface core those strings that are longer than 30 characters.

OR identify the string results that are missing full-stops.

How can I do this ?

Query: search strings that are missing full-stops/periods "."

q=fieldname: -*.*

blah
  • 674
  • 3
  • 17
  • There shouldn't be any such limitation, unless you've explicitly configured Solr to not index tokens longer than 30 characters. The URL syntax would be `q=fieldname:texttoquery` btw - and make sure to escape any spaces, etc. (and use quotes) Also remember that analyzed text - i.e. text that gets split into tokens will be indexed as separate tokens and might not be what you're looking for. – MatsLindh Sep 23 '21 at 13:36
  • I should have given more background info to my problem. I have a bunch of abstracts that I crawled and saved into Solr as sentences, in the field "sentence". Unfortunately, some of those are missing a full-stop, hence the sentences I made are still large paragraphs. I would like to find those sentences that contain more than X amount of characters or Identify those that are missing a fullstop. I attempted doing q=sentence:-*.*. (those that do not have a fullstops) but it fails. – blah Sep 23 '21 at 13:43
  • Add those details to your question together with your field type + your query. In addition, most special characters gets removed by the analysis chain, since they're not considered important for the tokens - if you need them, you're going to have to have an analysis chain that retains them for searching later. You query against the tokens, not against the plain text. – MatsLindh Sep 23 '21 at 13:50
  • Well, if I search for full-stops only, it works. q=sentence:*.* . If I include the - prohibit symbol to that, it fails. So there must be a simpler way? – blah Sep 23 '21 at 13:55
  • 1
    In that case it seems you have punctuation present in the token, i.e. it's a string or a KeywordTokenizer based field. You can try `q=*:* -field:*.*`, or possibly escape the `.` with \\. You can also try a regex match with `*.* -field:/\./` – MatsLindh Sep 23 '21 at 17:19

0 Answers0