Example #1
0
func filesInTable(ctx context.Context, esr esearch.Service) []string {
	req := &spb.SearchRequest{
		Fact: []*spb.SearchRequest_Fact{
			&spb.SearchRequest_Fact{
				Name:   "/kythe/node/kind",
				Value:  []byte("file"),
				Prefix: false,
			},
		},
	}
	repl, err := esr.Search(ctx, req)
	if err != nil {
		log.Fatalf("File search in serving tables failed: %v", err)
	}
	return repl.Ticket
}
Example #2
0
				Language:  req.Partial.Language != language,
			}
			for i := 0; i < len(flag.Args()); i = i + 2 {
				if flag.Arg(i) == schema.TextFact {
					log.Printf("WARNING: Large facts such as %s are not likely to be indexed", schema.TextFact)
				}
				v := strings.TrimSuffix(flag.Arg(i+1), suffixWildcard)
				req.Fact = append(req.Fact, &spb.SearchRequest_Fact{
					Name:   flag.Arg(i),
					Value:  []byte(v),
					Prefix: v != flag.Arg(i+1),
				})
			}

			logRequest(req)
			reply, err := idx.Search(ctx, req)
			if err != nil {
				return err
			}
			return displaySearch(reply)
		})
)

var (
	byteOffsetPointRE = regexp.MustCompile(`^b(\d+)$`)
	lineNumberPointRE = regexp.MustCompile(`^(\d+)(:(\d+))?$`)
)

func parsePoint(p string) (*xpb.Location_Point, error) {
	if m := byteOffsetPointRE.FindStringSubmatch(p); m != nil {
		offset, err := strconv.Atoi(m[1])