search fix (WHAT HAVE I DONE)
authorJan Szejko <janek37@gmail.com>
Mon, 26 Jun 2017 10:32:49 +0000 (12:32 +0200)
committerJan Szejko <janek37@gmail.com>
Mon, 26 Jun 2017 10:32:49 +0000 (12:32 +0200)
doc/schema.xml
src/search/management/commands/reindex.py
src/search/views.py

index 6b89c00..a202781 100644 (file)
 <!--   <field name="published_date" type="tdate" stored="false" indexed="true"/>-->
    <field name="published_date" type="string" stored="true" indexed="true"/>
 
 <!--   <field name="published_date" type="tdate" stored="false" indexed="true"/>-->
    <field name="published_date" type="string" stored="true" indexed="true"/>
 
-   <field name="themes" type="lowercase" stored="true" intexed="true" termVectors="true" termPositions="true" multiValued="true" />
+   <field name="themes" type="lowercase" stored="true" indexed="true" termVectors="true" termPositions="true" multiValued="true" />
    <field name="themes_pl" type="text_pl" stored="true" indexed="true" termVectors="true" termPositions="true" multiValued="true" />
    <field name="header_index" type="int" stored="true" indexed="true"/>
    <field name="header_span" type="int" stored="true" indexed="true"/>
    <field name="header_type" type="lowercase" stored="true" indexed="false"/>
    <field name="themes_pl" type="text_pl" stored="true" indexed="true" termVectors="true" termPositions="true" multiValued="true" />
    <field name="header_index" type="int" stored="true" indexed="true"/>
    <field name="header_span" type="int" stored="true" indexed="true"/>
    <field name="header_type" type="lowercase" stored="true" indexed="false"/>
-   <field name="text" type="text_pl" stored="false" indexed="true" termPositions="true" />
+   <field name="text" type="text_pl" stored="false" indexed="true" termVectors="true" termPositions="true" />
 
    <field name="snippets_position" type="int" stored="true" indexed="false"/>
    <field name="snippets_length" type="int" stored="true" indexed="false"/>
 
    <field name="snippets_position" type="int" stored="true" indexed="false"/>
    <field name="snippets_length" type="int" stored="true" indexed="false"/>
    <field name="fragment_anchor" type="string" stored="true" indexed="false"/>
 
    <field name="tag_id" type="int" stored="true" indexed="true"/>
    <field name="fragment_anchor" type="string" stored="true" indexed="false"/>
 
    <field name="tag_id" type="int" stored="true" indexed="true"/>
-   <field name="tag_name" type="lowercase" stored="true" intexed="true" />
+   <field name="tag_name" type="lowercase" stored="true" indexed="true" />
    <field name="tag_name_pl" type="text_pl" stored="false" indexed="true" multiValued="true"/>
    <field name="tag_category" type="string" stored="true" indexed="true" />
    <field name="is_pdcounter" type="boolean" stored="true" indexed="true" />
    <field name="tag_name_pl" type="text_pl" stored="false" indexed="true" multiValued="true"/>
    <field name="tag_category" type="string" stored="true" indexed="true" />
    <field name="is_pdcounter" type="boolean" stored="true" indexed="true" />
 
    <!-- <field name="payloads" type="payloads" indexed="true" stored="true"/> -->
 
 
    <!-- <field name="payloads" type="payloads" indexed="true" stored="true"/> -->
 
-   <!-- <field name="_version_" type="long" indexed="true" stored="true"/> -->
+   <field name="_version_" type="long" indexed="true" stored="true"/>
 
    <!-- Uncommenting the following will create a "timestamp" field using
         a default value of "NOW" to indicate when each document was indexed.
 
    <!-- Uncommenting the following will create a "timestamp" field using
         a default value of "NOW" to indicate when each document was indexed.
index f982b2a..b8cb49c 100755 (executable)
@@ -3,6 +3,8 @@
 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
 #
 import sys
 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
 #
 import sys
+import traceback
+
 from django.core.management.base import BaseCommand
 
 from optparse import make_option
 from django.core.management.base import BaseCommand
 
 from optparse import make_option
@@ -74,8 +76,8 @@ class Command(BaseCommand):
                     idx.index_book(b)
                     idx.index.commit()
                     books.pop(0)
                     idx.index_book(b)
                     idx.index.commit()
                     books.pop(0)
-                except Exception, e:
-                    print "Error occured: %s" % e
+                except:
+                    traceback.print_exc()
                     try:
                         # we might not be able to rollback
                         idx.index.rollback()
                     try:
                         # we might not be able to rollback
                         idx.index.rollback()
index 20b5e88..5b65a30 100644 (file)
@@ -135,7 +135,7 @@ def main(request):
     query = ' '.join(query.split())
     # filter out private use characters
     import unicodedata
     query = ' '.join(query.split())
     # filter out private use characters
     import unicodedata
-    query = ''.join(ch for ch in query if unicodedata.category(ch) == 'Co')
+    query = ''.join(ch for ch in query if unicodedata.category(ch) != 'Co')
 
     if len(query) < 2:
         return render_to_response(
 
     if len(query) < 2:
         return render_to_response(