Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

how_to_setup_solr.rst 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. ============================
  2. How to setup Solr with Oscar
  3. ============================
  4. `Apache Solr`_ is Oscar's recommended production-grade search backend. This
  5. how-to describes how to get Solr running, and integrated with Oscar. The
  6. instructions below are tested on an Ubuntu machine, but should be applicable
  7. for similar environments. A working Java or OpenJDK installation are necessary.
  8. .. _`Apache Solr`: https://lucene.apache.org/solr/
  9. Starting Solr
  10. =============
  11. You first need to fetch and extract Solr. The schema included with Oscar
  12. is tested with Solr 4.7.1:
  13. .. code-block:: bash
  14. $ wget http://apache.mirror.anlx.net/lucene/solr/4.7.1/solr-4.7.1.tgz
  15. $ tar xzf solr-4.7.1.tgz
  16. Next, replace the example configuration with Oscar's.
  17. .. code-block:: bash
  18. $ cd solr-4.7.1/example/solr/collection1
  19. $ mv conf conf.original
  20. $ ln -s <your_oscar_checkout>/sites/<sandbox|demo>/deploy/solr conf
  21. You should then be able to start Solr by running:
  22. .. code-block:: bash
  23. $ cd ../../..
  24. $ java -jar start.jar
  25. Integrating with Haystack
  26. =========================
  27. Haystack provides an abstraction layer on top of different search backends and
  28. integrates with Django. Your Haystack connection settings in your
  29. ``settings.py`` for the config above should look like this:
  30. .. code-block:: django
  31. HAYSTACK_CONNECTIONS = {
  32. 'default': {
  33. 'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
  34. 'URL': 'http://127.0.0.1:8983/solr',
  35. 'INCLUDE_SPELLING': True,
  36. },
  37. }
  38. If all is well, you should now be able to rebuild the search index.
  39. .. code-block:: bash
  40. $ ./manage.py rebuild_index --noinput
  41. Removing all documents from your index because you said so.
  42. All documents removed.
  43. Indexing 201 Products
  44. Indexing 201 Products
  45. The products being indexed twice is caused by a low-priority bug in Oscar and
  46. can be safely ignored.
  47. If the indexing succeeded, search in Oscar will be working. Search for any
  48. term in the search box on your Oscar site, and you should get results.