I tried looking for an example of getting around this but had no luck. Hopefully someone can point me in the right direction!
I have a Verity Collection. The description field of a record has a title, such as "Flowers & Candy Scented Candle"
When I type "Flowers & Candy" into a search, it returns no results.
If I type in just the word Flowers or Candy alone, it will find a result.
I am re-factoring some old code that did this through a fun and interesting sql query without use of the Verity Search engine.
Is there a quick way to get around this issue or get the Verity search to behave?
I considered enclosing the terms automatically in a quote but that might limit results.
cflib.org is your friend.
http://www.cflib.org/udf/verityClean
Related
I'm using this x-editable plugin (https://vitalets.github.io/x-editable/demo-bs3.html) and specifically the "Custom input, several fields" located towards the bottom of the demo.
First, everything is working just fine on the implementation but I'm struggling with how to save the submitted data (see screen shot below further down). I don't know how to reference value[address1] in my sql statement without Lucee thinking its a structure (I hope that makes sense in what I'm trying to say here). When I try to reference the variable reports via writeDump(form.value[address1]), Lucee provides me the following error:
key [value] doesn't exist
How do I reference form fields in the image? Should I change how the data is being submitted perhaps using jQuery's serialize() method?
It was much easier than I thought. I didn't even know you could do this!
local.address1 = form['value[address1]'];
Thanks to the comment made by #Matt-Busche in the SO question, ColdFusion Variable Name with brackets.
I have ran into some troubles using Open Street Map Nominatim search API. I am trying to search and geocode addresses, but for some queries, the results are quite strange.
For example, when I use query:
http://nominatim.openstreetmap.org/search?format=json&countrycodes=cz&limit=10&accept-language=cz&addressdetails=1&q=Jihlava
I get expected results - city Jihlava.
But when I use queries like (only part of name):
http://nominatim.openstreetmap.org/search?format=json&countrycodes=cz&limit=10&accept-language=cz&addressdetails=1&q=Jihl
or
http://nominatim.openstreetmap.org/search?format=json&countrycodes=cz&limit=10&accept-language=cz&addressdetails=1&q=Jihla
or
http://nominatim.openstreetmap.org/search?format=json&countrycodes=cz&limit=10&accept-language=cz&addressdetails=1&q=Jihlav
I get empty result list.
Is there anything wrong with my query?
Thanks.
That's expected behavior, for now. Nominatim has no auto-correction feature yet. Thus only partly matching queries aren't always handled correctly.
If you need auto-correction then please see if one of the other search engines for OSM fits your needs.
Maybe this is a new, mostly unused feature, but I am trying to create a collection based on a query from our DB. It's a simple Q&A and I'd like to rank the matches in the question higher than the answer. Seems logical as currently a search for "register for classes" the question "How do I register for classes" ranks lower than "How to I purchase books for my classes" because content in the books answers I guess matches better. So I'd like to bump the Q&A's if the question matches really well to the text in the query.
CF10 has a "Fieldboost" field on the cfindex however this is having 0 effect on results. I add it and remove it and nothing changes. The score and rank stays the exact same.
<cfindex action="refresh" collection="faq"
type="custom"
title="question"
body="question,answer"
fieldboost="question:6"
key="faq_id"
query="updateQuery"
location_i="location_id" />
`
So I searched Raymond Camden's site and found a little answer that I thought I had tried earlier, but maybe my syntax was wrong. I am using title:#URL.q#^2 which is working to boost the value of title in the search.
While this works, the CF10 docs indicate I should be able to do this with the fieldboost property, which I still cannot get to work.
According to the Solr documentation any field that is to be boosted must have omitNorms="false" in schema.xml. The default is false but is it possible it is being set to true in your schema.xml? The other issue I see in the above CFINDEX statement is that you're not specifying a field name in your fieldboost parameter, but rather a query column. If you want to boost on title then perhaps you need
<cfindex ... fieldboost="title:6" ... />
?
I've got a Haystack/xapian search index for django.contrib.auth.models.User. The template is simply
{{object.get_full_name}}
as I intend for a user to type in a name and be able to search for it.
My issue is this: if I search, say, Sri (my full first name) I come up with a result for the user object pertaining to my name. However, if I search Sri Ragh - that is, my full name, and part of my last name, I get no results.
How can I set Haystack up so that I can get the appropriate results for partial queries?
(I essentially want it to search *Sri Ragh*, but I don't know if wildcards would actually do the trick, or how to implement them).
This is my search query:
results = SearchQuerySet().filter(content='Sri Ragh')
I use to have a similar problem, as workaround or maybe a Fix you can change the query lookup
results = SearchQuerySet().filter(content__startswith='Sri Ragh')
The issue is that django-haystack doesn't implement all lingos from search engines. Of course you can do this.
results = SearchQuerySet().raw_search('READ THE SEARCH ENGINE QUERY SYNTAX FOR GET WILDCARD LOOKUPS')
As Django-haystack says, this is not portable.
You can use icontains or startswith.
Be careful with this one, if a query is for example 'r', this will bring you all 'Model' entities that have a 'r' in its content.
Model.objects.filter(content__icontains=query)
Model.objects.filter(content__startswith=query)
Look at the documentation
Say I request
parent/child/child/page-name
in my browser. I want to extract the parent, children as well as page name. Here are the regular expressions I am currently using. There should be no limit as to how many children there are in the url request. For the time being, the page name will always be at the end and never be omitted.
^([\w-]{1,}){1} -> Match parent (returns 'parent')
(/(?:(?!/).)*[a-z]){1,}/ -> Match children (returns /child/child/)
[\w-]{1,}(?!.*[\w-]{1,}) -> Match page name (returns 'page-name')
The more I play with this, the more I feel how clunky this solution is. This is for a small CMS I am developing in ASP Classic (:(). It is sort of like the MVC routing paths. But instead of calling controllers and functions based on the URL request. I would be travelling down the hierarchy and finding the appropriate page in the database. The database is using the nested set model and is linked by a unique page name for each child.
I have tried using the split function to split with a / delimiter however I found I was nested so many split statements together it became very unreadable.
All said, I need an efficient way to parse out the parent, children as well as page name from a string. Could someone please provide an alternative solution?
To be honest, I'm not even sure if a regular expression is the best solution to my problem.
Thank you.
You could try using:
^([\w-]+)(/.*/)([\w-]+)$
And then access the three matching groups created using Match.SubMatches. See here for more details.
EDIT
Actually, assuming that you know that [\w-] is all that is used in the names of the parts, you can use ^([\w-]+)(.*)([\w-]+)$ instead and it will handle the no-child case fine by itself as well.