Guest User

Untitled

a guest
Aug 17th, 2020
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.90 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. # Licensed to the Apache Software Foundation (ASF) under one or more
  4. # contributor license agreements. See the NOTICE file distributed with
  5. # this work for additional information regarding copyright ownership.
  6. # The ASF licenses this file to You under the Apache License, Version 2.0
  7. # (the "License"); you may not use this file except in compliance with
  8. # the License. You may obtain a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17.  
  18. import competition
  19. import sys
  20.  
  21. # simple example that runs benchmark with WIKI_MEDIUM source and taks files
  22. # Baseline here is ../lucene_baseline versus ../lucene_candidate
  23. if __name__ == '__main__':
  24. sourceData = competition.sourceData()
  25. comp = competition.Competition()
  26.  
  27. index = comp.newIndex('lucene_baseline', sourceData,
  28. facets = (('taxonomy:Date', 'Date'),
  29. ('taxonomy:Month', 'Month'),
  30. ('taxonomy:DayOfYear', 'DayOfYear'),
  31. ('sortedset:Month', 'Month'),
  32. ('sortedset:DayOfYear', 'DayOfYear')))
  33.  
  34. #Warning -- Do not break the order of arguments
  35. #TODO -- Fix the following by using argparser
  36. if len(sys.argv) > 3 and sys.argv[3] == '-concurrentSearches':
  37. concurrentSearches = True
  38. else:
  39. concurrentSearches = False
  40.  
  41. # create a competitor named baseline with sources in the ../trunk folder
  42. comp.competitor('baseline', 'lucene_baseline',
  43. index = index, concurrentSearches = concurrentSearches)
  44.  
  45. index_candidate = comp.newIndex('lucene_candidate', sourceData,
  46. facets = (('taxonomy:Date', 'Date'),
  47. ('taxonomy:Month', 'Month'),
  48. ('taxonomy:DayOfYear', 'DayOfYear'),
  49. ('sortedset:Month', 'Month'),
  50. ('sortedset:DayOfYear', 'DayOfYear')))
  51.  
  52. # use the same index here
  53. # create a competitor named my_modified_version with sources in the ../patch folder
  54. # note that we haven't specified an index here, luceneutil will automatically use the index from the base competitor for searching
  55. # while the codec that is used for running this competitor is taken from this competitor.
  56. comp.competitor('my_modified_version', 'lucene_candidate',
  57. index = index_candidate, concurrentSearches = concurrentSearches)
  58.  
  59. # start the benchmark - this can take long depending on your index and machines
  60. comp.benchmark("baseline_vs_patch")
Add Comment
Please, Sign In to add comment