callback to insert index
(self, url, content, depth)
| 247 | self.db_conn.close() |
| 248 | |
| 249 | def process_document(self, url, content, depth): |
| 250 | """callback to insert index""" |
| 251 | print("Indexing '%s' (depth %s)..." % (url, depth)) |
| 252 | name = self._extract_name(content).replace('\n', '') |
| 253 | keywords = self._extract_keywords(content) |
| 254 | |
| 255 | entry = {'url': url, 'keywords': set(), 'aliases': set()} |
| 256 | self.results[name].append(entry) |
| 257 | |
| 258 | for n in self._parse_title(name): |
| 259 | """ add as keyword """ |
| 260 | entry["keywords"].add(n) |
| 261 | |
| 262 | """ add as keyword without std:: """ |
| 263 | if n.find("std::") != -1: |
| 264 | entry["keywords"].add(n.replace('std::', '')) |
| 265 | |
| 266 | """ add with all keywords variations """ |
| 267 | for k in keywords: |
| 268 | """ add std:: to typedef if original type is in std namespace """ |
| 269 | if n.find("std::") != -1 and k.find("std::") == -1: |
| 270 | k = "std::" + k; |
| 271 | |
| 272 | entry["aliases"].add((n, k)) |
| 273 | prefix = _commonprefix(n, k) |
| 274 | |
| 275 | if len(prefix) > 2 and prefix[-2:] == "::": |
| 276 | """ Create names and keyword without prefixes """ |
| 277 | new_name = n[len(prefix):] |
| 278 | new_key = k[len(prefix):] |
| 279 | entry["aliases"].add((new_name, new_key)) |
| 280 | |
| 281 | if k.find("std::") != -1: |
| 282 | entry["aliases"].add( |
| 283 | (n, k.replace('std::', ''))) |
| 284 | |
| 285 | return True |
| 286 | |
| 287 | def _results_with_unique_title(self): |
| 288 | """process crawling results and return title -> entry dictionary; |
nothing calls this directly
no test coverage detected