Using Lucene Highlighter along with MultiFieldQueryParser - parsing

Im using Lucene Highlighter to highlight the matches that I have found in a Lucene Index. Now, my problem is that If I have to search multiple fields of a document, and I need to display the matching text, then how can I get in which field the hit has occurred?
The code which I am using for the highlighter is basically the second function here
If I do not know in which field the hit has occurred in, then what field do I pass to the function defined above to get the matching fragments?

You could combine the fields into a single text field and run your highlighter on it.

Related

Querying lucene index with arbitrary long article text to check for all matches within article (through neo4j)

I'm trying to query the lucene index I've added to a neo4j field (it's a "name" field, that isn't very long, one to ten words at most).
What I do right now is take all the text in a given webpage, sanitize it with a javascript function to keep only words, spaces and alphanumeric characters, and use that to query my index.
.replace(/[^\w\s]|or|and|not|return+/gi, "") // <- escaping the input
I'm not sure if the length of the search text is limited somehow, but results do seem to disappear after about 1050 words (~6500 characters).
Ideally, I'd like to be able to use a couple thousand words in one query, with the end goal of highlighting the matches found within the webpage itself.
Why is my query not returning any results past a certain number of characters ? Am I missing some keyword in my escaping regex ?
Is what I'm trying to achieve feasible ? Is there a better approach I could use ?
Thanks for reading :)
(for anyone finding this, I found a somewhat related question here: Handling large search queries on relatively small index documents in Lucene)

QUERY function not including text cells along with number cells in result

I'm currently trying to copy a list using the QUERY function in google-sheets.
The problem im now facing is that words / letters are not included in the search.
Example picture
Im using the function: "=QUERY(E2:F5;)" but don't get the words included.
Is there any way to include these words by using the formula above as guide?
In google-sheets, use Format, Number, Plain Text on your source range of E2:F5 and your original formula will work.
=QUERY(E2:F5)
From Docs Editor Help - QUERY function
In case of mixed data types in a single column, the majority data type determines the data type of the column for query purposes. Minority data types are considered null values.

How to give multiple hyperlink to single string

I am of the opinion that giving multiple hyperlink to a single string is not possible in MS word document. I don't have any knowledge of C# but I think after reading How insert multiple hyperlinks to one comment in MS WORD using C#? I just want to clarify weather multiple hyperlink to a single comment is possible or not.
For example I have a "string"
I want to give different hyperlinks like this
example.com/s
example.com/t
example.com/r
example.com/i
example.com/n
example.com/g
So that I get change to select where I want to go from that string.
In Word, a hyperlink is not a string, it's a field code. Field codes are special objects. It is, therefore, not possible to pass multiple hyperlink objects as part of a string. You can't even pass one hyperlink object as part of a string...
You can pass multiple hyperlink strings as a delimited string, then "split" the string into an array, loop the array to create multiple hyperlink objects.
If you want to open a hyperlink or hyperlinks from code, there is a FollowHyperlink method, as I recall (I'm on a mobile device at the moment, so can't double-check). You can pass a string to that.

Select2: Display all search results which contain the characters in sequence

I want to use select2 search such that it also displays results which do not match the options strictly.
Eg. If hello world is present in the select box, typing hl or hw should return hello world as search result.
The default matcher provided by Select2 does exact searches, but it can be extended to do custom matching.
A matcher like you are looking for can be found at this pull request.

Multiple field values to subreport error

I have a parent report that feeds one of the field values into a subreport. But the problem is that there this field value can include multiple records. For simplicity, assume that this field value is called color, where possible values might be orange, red, and green. I need to pass all of these value to the subreport, not just one. I have tried passing the values this way into the Color parameter of the subreport:
=Fields!Color.Value
But this doesn't work and gives me an error. I have also tried:
=join(Fields!Color.Value,",")
This also gives me an error on the subreport
I have also tried both of the above as an expression in a textbox in the parent report and I get #Error displayed on the parent report. I was able to successfully get just the first value to appear by using a similar expression and the First function. But I am not able to get all of the values to display in this textbox on the parent report? how can I do this or at least pass all of the values to this subreport?
The easy solution is if Color is already a parameter - I would pass this expression in the subreport:
=Parameters!Color.Value
If Color is not a parameter, I would add a column to the driving dataset in the parent report using a SELECT ... FOR XML to concatenate the relevant Color values together. Then you can pass that field to the subreport.

Resources