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" ... />
?
Related
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
Some details about my product list first:
Static, contains about 400 items.
It will not grow any further. Trust me on this one.
No duplicate item names.
Properties of products will not change.
Basically think of my product list as the periodic table. I do not see any point of adding the id to the URL with the "slug name" (or whatever it's called). I'd rather have a clean SEO friendly URL. Is there something I'm overlooking here?
Here's the thing about IDs and slug names:
Using "product-id":
Usually, URLs are designed using the ID:
"/products/[product-id]"
example: /products/213
But they are too little descriptive about what's exactly in that URL (I mean, different URLs will have different IDs, but this alone - just by looking at it - will not give you any information about that specific URL.)
Botoom line: ID-only is bad because it is little descriptive.
Using "product-name":
Using:
"/products/[product-name]"
example: /products/three-legged-walking-oven
Is actually pretty good, the caveats are:
How are you going to map a [product-name] into a [product-id]?
Titles (or [product-name]) change a lot, what if someone bookmarks an old title?
Using "[product-id]/[product-name]":
Using:
"/products/[product-id]/[product-name]"
example: /products/213/three-legged-walking-oven
or
"/products/[product-id]-[product-name]"
example: /products/213-three-legged-walking-oven
In this approach, you get the product by the id part of the URL.
Gives you the best of both worlds: descriptive urls AND easy to map urls AND titles (names) can change without making old URLs useless.
Your scenario:
So, if you are 100% certain you'll never change your products' name, you can go on and use "product-name". Just find a way to map that "product-name" into a "product-id" in an efficient way.
Bonus: Make sure you check out this nice article about the importance of using slug names and search engines.
Since whatever is at the end of the url is what your app will use to look up the product in the database, this turns into a database question. Keeping the id in the url lets your app look things up by id.
If your product names will never ever change, and you can actually use the product name as a primary key (or at least have a unique index on the colum) in your database, then you might get away with using just the product name in your URL as well.
Usually, it's better practice to have a unique, meaningless field as your primary key, because things like product names tend to change in most cases, even if only to fix typos.
The only reason i can think of is that to use /products/[id]-[name], you need to know both the id and the [name], to use the second option you only need to know the name.
A more common choice here would be to use : /products/[id]
I would only consider /products/[name] if you are confident if name is: short, unique, does not contain any special characters (&, ? #, / , ...)
Hello Graph API experts,
When you call /[post_id , the result contains "comments" field which has "count" field that is supposed to have the total number of comments for this particular post.
Now, if you call /[post_id]/comments , you get the actual comment data, one by one.
The problem I am facing is that, when I compare the "comments.count" field's value and the number of all of the actual comment data returned, they are different.
What's even worse, if you then look at the same post on Facebook.com's Timeline where you can see the number of comments for that post (i.e. "view all * comments" link), this number is also different from the "comments.count" field value.
And this is not only happening to one post, but to many of them - I observe this tend to happen more to posts with more than 100 comments (I actually counted all the comments on Timeline, and it matched the number of the actual comment data returned from /[post_id]/comments API call).
Is this a normal API behaviour? Which number should I or would you trust if this is the way it is?
ok, when you looking some facebook comment counts on some timeline posts, you woulld see that count for ex. 16 comments, and when you try to count comments manually on the post you may see it's looking 15 comments, so where is it that missing comments ? is that a wrong count by facebook ? no not actually, it's because, some people changing profile privacies as like don't show my comments people who aren't my friends, or we haven't any mutual friends, etc. it's because you cannot get these privatized comments from graph api, but these comments aren't excluding in total count. So what's the solution, just be sure get all the data correctly what facebook provide you. And compare it, how many comments looking like missing, and show missing counts as private comments count in your application. I think is much better.
Welcome to the world of Facebook API programming. Yes, this is normal (but apparently not desired) API behavior. This is one of the inconsistencies we're faced with when programming around their API. CBroe is probably correct in his comment above, it is data inconsistencies between servers in their API cluster.
in addition to this there are problems with pagination, you can use the offset + limit parameters to say how much data you want and from where to take it, if you deal with number of posts, you can say offset=0 and limit=50 and it'll work, but then if you try offset=100 and limit=50 it might return empty data, but then try offset=100 and limit=100 and it'll return 100 posts.
the api is just buggy and full of inconsistencies which don't seem to have any way to solve them.
I think we got oversold on the opengraph, I don't think it's what facebook told us it would be and I'm starting to feel the burn from selling that to my boss and finding out that I perhaps can't deliver :(
I'm working on getting django-haystack set up on my site, and am trying to have snippets in my search results roughly like so:
Title of result one about Wikis ...this special thing about wiki values is that...I always use a wiki when I walk...snippet value three talks about wikis too...and here's another snippet value
about wikis.
I know there's a template tag that uses Haystack code to do the the highlighting, but the snippets it generates are pretty limited:
they always start with the query word
there's only one snippet value
they don't support asterisk queries
and other stuff?
Is there a way to use the Solr backend to generate proper snippets as shown above?
Bottom line is that the Solr highlighting can't really be used by Haystack in a flexible way. I spoke to the main developer for Haystack on IRC, and he said basically, if I want to have the kind of highlighting I'm looking for, the only way to get it is to extend the Solr backend that Haystack uses.
I dabbled in that for about half a day, but couldn't get Haystack to recognize my custom back end. Haystack has some magic backend loading code that just wasn't working with me.
Consequently, I've switched over to sunburnt, which provides a lighter-weight and more extensible wrapper around Solr. I'm hoping it will fare better.
from haystack.utils import Highlighter
my_text = 'This is a sample block that would be more meaningful in real life.'
my_query = 'block meaningful'
highlight = Highlighter(my_query)
highlight.highlight(my_text)
http://docs.haystacksearch.org/dev/highlighting.html
i'm developing a site that must be as accessible as possible. While assigning the accesskeys to my form fields with
widget=FieldWidget(attrs={'accesskey':'A'})
i found out that the w3c validator won't validate an xhtml strict page with an accesskey in a select tag. Anyway i couldn't find a way to assign an accesskey to the label related to the select field (the right way to make the select accessible). Is there a way to do so?
Thanks
Interesting question. HTML 4.01 also prohibits accesskey in a select.
I believe the Short Answer is: Not in standard Django.
Much longer answer: I looked at the code in django/forms/fields.py and .../widgets.py and the label is handled strictly as a string (forced to smart_unicode()). Four possible solutions come to mind, the first three are not pretty:
Ignore the validation failure. I hate doing this, but sometimes it's a necessary kludge. Most browsers are much looser than the DTDs in what they allow. If you can get the accesskey to work even when it's technically in the wrong place, that might be the simplest way to go.
Catch the output of the template and do some sort of ugly search-and-replace. (Blech!)
Add new functionality to the widgets/forms code by MonkeyPatching it. MonkeyPatch django.forms.fields.Field to catch and save a new arg (label_attrs?). MonkeyPatch the label_tag() method of forms.forms.BoundField to deal with the new widget.label_attrs value.
I'm deliberately not going to give more details on this. If you understand the code well enough to MonkeyPatch it, then you are smart enough to know the dangers inherent in doing this.
Make the same functional changes as #3, but do it as a submitted patch to the Django code base. This is the best long-term answer for everyone, but it's also the most work for you.
Update: Yoni Samlan's link to a custom filter (http://www.djangosnippets.org/snippets/693/) works if you are generating the <label> tag yourself. My answers are directed toward still using the full power of Forms but trying to tweak the resultant <label>.
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