caljer1 / auto-repair-shop

Automatically exported from code.google.com/p/auto-repair-shop
0 stars 0 forks source link

Find Customer with a phone number crash deployed app on GAE #30

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Go to: http://auto-repair-shop.appspot.com/
2. Click on "Find Customer" in side panel
3. Enter a phone # in Primary Phone field
4. Click on "Find Customer(s)" button

What is the expected output? 
Either a list of matching customer or a message "No customers match the search 
you requested"

What do you see instead?
Go to Internal Error page with following Traceback:

NeedIndexError: no matching index found.
This query needs this index:
- kind: CustomerEnt
  properties:
  - name: phone1
  - name: last_name_search
  - name: first_name_search
  File "/base/data/home/apps/auto-repair-shop/2-1.334317788271018294/dermico.py", line 
159, in handle_button_events
    dispatch_function(self, reqhandler, bIndex)

  File "/base/data/home/apps/auto-repair-shop/2-1.334317788271018294/dermico.py", line 
419, in doSearch
    searchResults = self.__model.searchForMatchingCustomers(searchCriteria)

  File "/base/data/home/apps/auto-repair-shop/2-
1.334317788271018294/MaintAppModel.py", line 390, in searchForMatchingCustomers
    customers = query.fetch(limit)

  File "/base/python_lib/versions/1/google/appengine/ext/db/__init__.py", line 1426, in fetch
    raw = self._get_query().Get(limit, offset)

  File "/base/python_lib/versions/1/google/appengine/api/datastore.py", line 959, in Get
    return self._Run(limit, offset)._Get(limit)

  File "/base/python_lib/versions/1/google/appengine/api/datastore.py", line 908, in _Run
    str(exc) + '\nThis query needs this index:\n' + yaml)

Original issue reported on code.google.com by jerome.c...@gmail.com on 19 Jun 2009 at 6:00

GoogleCodeExporter commented 9 years ago
This issue doesn't occur on the app. running locally.

Original comment by jerome.c...@gmail.com on 19 Jun 2009 at 6:02

GoogleCodeExporter commented 9 years ago
This is a tricky issue. In theory, search based on every possible fields 
combination 
requires an index. Say each search below requires its own index:
- serach on phone1
- search on addr1
- on email
- on phone1 and email
- on phone1 and addr1
- on addr1 and email
- on phone1 and addr1 and email

And the list can go on and on, on every possible combination of fields. These 
indexes are generated automatically when we run the searches locally. We just 
need 
to upload the index file that contains all the generated indexes.

Thus, the right way to do this is, during testing we test all possible search 
scenarios and get the full index file with all the indexes. Then we will not 
run 
into the same problm again.

However, during my tests, I didn't do an extensive combination as there are 
really 
too many possible combinations of fields. 

So please let me know if we need the extensive list. It will take some time to 
generate but we can be sure the app won't crash. 

Just an aside. For real application, you may not want too many indexes becauses 
once 
an index is generated, it needs to be updated whenever there is any change to 
the 
index's constituent fields. In other words, a change to a record field will 
requires 
an update to all the indexes that contains that field. Indexes can cause 
performance 
issue if they are not well managed. :)

Original comment by fionawhw...@gmail.com on 19 Jun 2009 at 6:36

GoogleCodeExporter commented 9 years ago
Issue fixed: Wing generated new indexes for various combinations of search 
scenarios. The app is now re-
deployed on GAE with a new index.yaml file. 
~ Jerome

Original comment by jerome.c...@gmail.com on 21 Jun 2009 at 1:27