|
25 | 25 | with open(join(dirname(__file__), '../resources/example.html'), 'r') as document: |
26 | 26 | config = { |
27 | 27 | 'retrieve_and_rank': { |
28 | | - 'dry_run':'true' |
| 28 | + 'dry_run': 'true' |
29 | 29 | } |
30 | 30 | } |
31 | 31 | print(json.dumps(document_conversion.index_document(config=config, document=document), indent=2)) |
32 | 32 |
|
33 | 33 | print("########## Example of a dry run of index_document with only metadata ##########") |
34 | 34 | config = { |
35 | 35 | 'retrieve_and_rank': { |
36 | | - 'dry_run':'true' |
| 36 | + 'dry_run': 'true' |
37 | 37 | } |
38 | 38 | } |
39 | 39 | metadata = { |
40 | 40 | 'metadata': [ |
41 | | - {'name':'id', 'value':'12345'} |
| 41 | + {'name': 'id', 'value': '12345'} |
42 | 42 | ] |
43 | 43 | } |
44 | 44 | print(json.dumps(document_conversion.index_document(config=config, metadata=metadata), indent=2)) |
|
47 | 47 | with open(join(dirname(__file__), '../resources/example.html'), 'r') as document: |
48 | 48 | config = { |
49 | 49 | 'retrieve_and_rank': { |
50 | | - 'dry_run':'true' |
| 50 | + 'dry_run': 'true' |
51 | 51 | } |
52 | 52 | } |
53 | 53 | metadata = { |
54 | 54 | 'metadata': [ |
55 | | - {'name':'id', 'value':'12345'} |
| 55 | + {'name': 'id', 'value': '12345'} |
56 | 56 | ] |
57 | 57 | } |
58 | 58 | print(json.dumps(document_conversion.index_document(config=config, document=document, metadata=metadata), indent=2)) |
|
62 | 62 | config = { |
63 | 63 | 'convert_document': { |
64 | 64 | 'normalized_html': { |
65 | | - 'exclude_content': {"xpaths":["//body/div"]} |
| 65 | + 'exclude_content': {"xpaths": ["//body/div"]} |
66 | 66 | } |
67 | 67 | }, |
68 | 68 | 'retrieve_and_rank': { |
69 | | - 'dry_run':'true' |
| 69 | + 'dry_run': 'true' |
70 | 70 | } |
71 | 71 | } |
72 | 72 | metadata = { |
73 | 73 | 'metadata': [ |
74 | | - {'name':'id', 'value':'12345'} |
| 74 | + {'name': 'id', 'value': '12345'} |
75 | 75 | ] |
76 | 76 | } |
77 | 77 | print(json.dumps(document_conversion.index_document(config=config, document=document, metadata=metadata), indent=2)) |
78 | 78 |
|
79 | | -print("########## Example of index_document with document, metadata (A service instance id, SOLR cluster id, and " |
80 | | - "a SOLR collection name must be provided from the Retrieve and Rank service in order to index) ##########") |
81 | | -with open(join(dirname(__file__), '../resources/example.html'), 'r') as document: |
82 | | - config = { |
83 | | - 'retrieve_and_rank': { |
84 | | - 'dry_run':'false', |
85 | | - 'service_instance_id':'YOUR RETRIEVE AND RANK SERVICE INSTANCE ID', |
86 | | - 'cluster_id':'YOUR RETRIEVE AND RANK SERVICE SOLR CLUSTER ID', |
87 | | - 'search_collection':'YOUR RETRIEVE AND RANK SERVICE SOLR SEARCH COLLECTION NAME' |
88 | | - } |
89 | | - } |
90 | | - metadata = { |
91 | | - 'metadata': [ |
92 | | - {'name':'id', 'value':'12345'} |
93 | | - ] |
94 | | - } |
95 | | - print(json.dumps(document_conversion.index_document(config=config, document=document, metadata=metadata), indent=2)) |
| 79 | +# print("########## Example of index_document with document, metadata (A service instance id, SOLR cluster id, and " |
| 80 | +# "a SOLR collection name must be provided from the Retrieve and Rank service in order to index) ##########") |
| 81 | +# with open(join(dirname(__file__), '../resources/example.html'), 'r') as document: |
| 82 | +# config = { |
| 83 | +# 'retrieve_and_rank': { |
| 84 | +# 'dry_run': 'false', |
| 85 | +# 'service_instance_id': 'YOUR RETRIEVE AND RANK SERVICE INSTANCE ID', |
| 86 | +# 'cluster_id': 'YOUR RETRIEVE AND RANK SERVICE SOLR CLUSTER ID', |
| 87 | +# 'search_collection': 'YOUR RETRIEVE AND RANK SERVICE SOLR SEARCH COLLECTION NAME' |
| 88 | +# } |
| 89 | +# } |
| 90 | +# metadata = { |
| 91 | +# 'metadata': [ |
| 92 | +# {'name': 'id', 'value': '12345'} |
| 93 | +# ] |
| 94 | +# } |
| 95 | +# print(json.dumps(document_conversion.index_document(config=config, document=document, metadata=metadata), indent=2)) |
0 commit comments