Algolia highlighResult or snippetResult only what matches - highlighting

If I search for "brown" I would like to have all or any of my results that contain "brown" within them only highlight that section.
Currently if I were to search "brown" my results appear like this (bold = highlighted)
brown
brownies
When I would like the result to be
brown
brownies
Any suggestions on how I could make this happen?
I am currently using snippetResults and the object for brownies would say matchLevel: "full", value: "<em>brownies</em> when it is not actually a full match.
Thank you!

The default behaviour is actually to highlight only the matching part. To help you more on that, I'd need to have more informations like the name of your index and its configuration. Could you send us an email at support#algolia.com, we would be happy to help.

Related

How to extract specific lines from a text document?

I am no expert in coding or anything but I figured it out this website would be the best to achieve what I want. So, I got my personal data from Spotify, and they give you how much you played a song and all of the play history and I want to calculate how much I listened in total, the problem is I don't know how can I extract the specific lines from the text document with only the time and then calculate it.
The text is something like this:
{
"endTime" : "2020-11-21 22:23",
"artistName" : "Kanye West",
"trackName" : "Devil In A New Dress",
"msPlayed" : 351946
},
and there are a lot of songs, I just want to extract the "msPlayed" thing so I can calculate it, any help?
Go here: https://regex101.com/r/RLDYUj/1
Put your text into the "Test String" part
Copy in your clipboard the numbers list in the "Substitution" part
Go here: https://miniwebtool.com/sum-calculator/
Paste the numbers list and compute the sum

django 1.10 postgres full text search is not working

I am trying to integrate full text search for django 1.10 with postgres database.
I am following tutorial from
https://docs.djangoproject.com/en/1.10/ref/contrib/postgres/search/
class Question(models.Model):
text = models.TextField(max_length=500)
ans = models.TextField(max_length=1500, blank=True)
I have several questions in the database which has the text 'for' in its text field for example: one question is:
text: what is best for me?
ans: this is best for you.
I am trying to make a query like
q = Question.objects.filter(text__search='for')
But this query is not returning any result. can anyone suggest me why?
It is actually my mistake. For Full text search when Postgres creates index it by default ignore common words like 'the', 'for', 'are','is' etc. So If you try to search using this keywords you search query will return empty even if there are lots of sentences with these words.
I did not know this. So I thought I misconfigured.

How to check if selected text is a valid word

Question sounds easy as we think but I couldn't find a solution with any of this: regexp, asc, check space around
For example, in text "Hello world", I can allow "Hello" or "world", but I should not allow user-selection like "Hel", "Worl"
So, if user not selecting a full-word, then I should throw an error. Any thoughts please?
create a dictory with all english words.
then you cound check the text is valid or not.
The all words you could get from web api like below:
http://developer.dictionary.com/
http://googlesystem.blogspot.com/2009/12/on-googles-unofficial-dictionary-api.html

Part of speech search with lucene

After many googling searchs I decided to post my problem here hoping that someone help me. What I want to achieve is to perform queries as follows:
q1: (adjective) "jumps" (preposition) // any adj followed by "jumps" followed by any prep.
q2: (adjective:brown) "jumps" (preposition) // brown as adj. followed by "jumps" followed by any prep.
q3: (adjective:brown) (verb:jumps) (preposition) // brown as adj followed by jumps as verb followed by any preposition.
In a more general form, what I want is
(POS[:specific_word]) (POS[:specific_word]) (POS[:specific_word])
For that, I have the text tagged as follows:
the|[pos:DT][lemma:the] quick|[pos:JJ][lemma:quick] brown|[pos:JJ][lemma:brown] fox|[pos:NN][lemma:fox] jumps|[pos:NNS][lemma:jump] over|[pos:IN][lemma:over] the|[pos:DT][lemma:the] lazy|[pos:JJ][lemma:lazy] dog|[pos:NN][lemma:dog]
The first thing I thought was to index extra info of each term as payload and using PayloadNearQuery after in order to access to the payload of each span. The problem is that PayloadNearQuery match the terms first and then access its payload, so none of the 3 above queries will work. (correct me if I'm wrong)
The second thing I thought was to index extra info as synonyms of the term but, this way, the second query won't work since I can't ask if the first term is an adj and the specific word "brown" simultaneously.
Any way to address this problem, suggestions, etc. will be appreciated.

Appcelerator Cloud Services - Find string in photos object custom field

I'm having trouble using the query/search capabilities of Cloud.photos, more specifically, finding a way of search for a string in title field.
After reading this: http://docs.appcelerator.com/cloud/latest/#!/guide/search_query, I was able to perform querys with $regex:
where: {title: {'$regex' : '^' + searchterm}},
But works only if the search term is in the beginning of the title, and it's case sensitive (I'm obviously a complete regex newbie).
Also tried search API with no luck. I didn't find which were the searchable fields.
So, I'm in some sort of dead end. I'm looking for a SQL like similar funcionality, where I can perform a search of a term and if matches regardless of the position and whether it is upper or lower case.
Thanks in advance.
see the release notes here for 11 Apr 2013
http://docs.appcelerator.com/cloud/latest/#!/guide/acs_releasenotes
it cannot be done any other way because the query would be too inefficient