Site search with options while searching - django

I'd like to create a search on my site like dividata.com has. That means, it only searches by stock symbol and stock name and users may select something only if there exists a record of it? How can I do that? Can you point me to an article or something where I may find information how to do it?
I'm using django on openshift. I looked at haystack and elastic search, but it looks like integration of elasticsearch on openshift won't be that easy. But I think I don't need something as complex as elasticsearch. Thanks.

Maybe this can help if you are looking for autocomplete search bar, I've solved that but I have problem with something else.
Django-haystack full text search working but facets don't

Related

Would it be possible to build faceted search with django-filters and Postgres Full-Text Search?

I want to build faceted search with django-filters and Postgres Full-Text Search. But I didn't find anywhere how to do it. May it be impossible. I noticed that people build faceted search with elastic. But I don't know it will be works with django-filters, or I will need to build without it.
It needs me for search and filters books/
Can you give me any advice how to do it?

Advanced search in Django

I am working on a social blogging site using Django and I need to create an advanced search bar with filters like location and authors. I do have a basic one working as of now. Can someone help me with the concept on how to add filters to it. couldn't find much related stuff with django. Thanks
Assuming you want to retrieve data from a database, using the Django ORM, you can use the filter method of the Queryset class.
That said, we can't help you more without a context, how you expect the filters to behave, the models behind the scene, or anything more than "how to conceive an advanced search in Django"...

Filtering with elastic-search and django

I've configured elastic search within my django project. The next step is to apply some filtering options of those searches. The content of each search is Cars, so I'd like to be able to filter on Model, Price, Petrol/Diesel etc.
Any thoughts on how to achieve this?
Thanks,
EDIT: I'm using Haystack.

Rewrite href links in strings

I have a bespoke CMS for a website that stores any uploaded files in the /Assets/ folder.
I'm preparing to move the website to the Azure platform and need some way of rewriting the links within the web pages. Here is what a current link looks like:
link to file
What do you suggest would be the best way to change those links to something like:
link to file
There are 100's of pages with tons of links. Also, to throw a spanner in the works, not all links are in sub folders within the assets folder.
Some links are like:
link to file
Suggestions are welcome, I'm open to anything, regex, htmlagilitypack or plain old string.Replace but I can't seem to get my head around how to do it...
You should take a look at the IIS Url Rewriting module which is installed on Azure web roles.
http://www.iis.net/learn/extensions/url-rewrite-module/using-the-url-rewrite-module
It basically allows you to define patterns using regex and ouput URLs however you like. In your case it would be quite simple to rewrite your embedded links to their locations in blob storage.
It's ok, I have sorted it, thanks for your comments. If anyone is interested I did a search & replace SQL query on the database.

Django: Haystack or ORM

For a project I implemented Haystack but now I was wondering what the pros and cons are of using Haystack over the ORM. For my project I need to find books by their title and isbn. I guess Haystack is more useful if you have to do full text searches or am I missing something?
Haystack is certainly better for full text search, and also provides a bunch of other benefits that you won't get using the ORM. Here are some from the Haystack site:
Spelling suggestions
Faceting
More like this
Highlighting
Search term boosting
Besides that, you should use Haystack over the ORM if you expect a high volume of searches, since you'll offload all that work from the DB (which should be focused on writing and retrieving your data).
http://haystacksearch.org/
The main advantage to use haystack over the ORM is performance. LIKE requests are just going to kill you database if you have 100 concurrent users searching. If you have MYSQL of course you can still use its full text capability, but it will still be slower than Xapian or Solr.
Plus you will have additional features such as fuzzy searching that user loves a lot.
It does comes with the extra work of setting up solr and maintaining it, so:
if your website is going to be small forever, like for small company intranet, don't bother and user ORM.
if you plan for the big bad Web, go Haystack.
And not forget to mention that doing a basic haystack setup isn't really much more work than doing a search view using Django's ORM.
Haystack is a module that enables easier search integrations for your django application
you can create something similiar to a ModelForm, called ModelIndex, in this new class you will be able to declare the searchable fields of your models and other settings
It has little to do with Django ORM (the orm is used to comunicate with your databases)
of course you can have the orm query your db models with the search pattern specified, but Haystack is a better choice for setting up a search engine easily on your website, so... if you have to enable complex searches on your site, just go with Haystack